Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: regexing to remove punctutation in telephone numbers
- X-seq: zsh-users 6858
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx (Zsh users list)
- Subject: Re: regexing to remove punctutation in telephone numbers
- Date: Wed, 10 Dec 2003 13:03:13 +0000
- In-reply-to: "Eric Smith"'s message of "Wed, 10 Dec 2003 13:46:17 +0100." <20031210124617.GA3027@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Eric Smith wrote:
> Could someone suggest a neat zsh way to convert
>
> $ myfax 00-(123) 4567-890 _some_file_name_ AnotherFileName.ps whatever
>
> to
>
> 001234567890 _some_file_name_ AnotherFileName.ps whatever
I don't know how flexible you want to be, but:
myfax () {
command myfax "${1//[-()]}${2//[-()]}" ${argv[3,-1]}
}
removes the offending characters from the first two arguments and
joins them together.
pws
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author