Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: regexing to remove punctutation in telephone numbers



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