Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: regexing to remove punctutation in telephone numbers
- X-seq: zsh-users 6859
- From: Eric Smith <es@xxxxxxxxxxxx>
- To: Zsh users list <zsh-users@xxxxxxxxxx>
- Subject: Re: regexing to remove punctutation in telephone numbers
- Date: Wed, 10 Dec 2003 14:17:56 +0100
- In-reply-to: <7336.1071061393@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20031210124617.GA3027@xxxxxxxxxxxx> <7336.1071061393@xxxxxxx>
Peter Stephenson said:
> 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:
Thanks Peter,
Thats exactly the point ...
>
> myfax () {
> command myfax "${1//[-()]}${2//[-()]}" ${argv[3,-1]}
> }
There can be n number of args with the offending punctutation characters.
And n should be determined from the first arg that commences in a non
[-()0-9] character.
--
Eric Smith
Messages sorted by:
Reverse Date,
Date,
Thread,
Author