Sorry, I didn't read the last part of you message so ignore my first question.

On Tuesday 18 May 2004 20:16, Amir Hardon wrote:
> Hi Ehud, first I'll thank you.
> I wrote this thing as a learning exercise for REs and you helped me
> learning more.
>
> I have one question before using the way you suggested,
> wouldn't it be better to call sed once, using a search pattern similar to
> the one in the first sed(different for each number), and replacing straight
> to the new number?
>
> And something general, when sed is called with multiple commands using -e
> does it goes through the file once, or once for each command?
>
> Thanks,
>       -Amir.
>
> On Tuesday 18 May 2004 18:25, you wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On Mon, 17 May 2004 21:08:26 +0300, Amir Hardon <[EMAIL PROTECTED]> 
wrote:
> > > Hi,
> > > I wrote a small bash script to update KAddressBook for the new phone
> > > numbers. It's safe to use on partly updated address books, or for
> > > re-running. The script back ups the data file before changing it so
> > > don't worry about losing anything.
> > > The supported patterns are 050-123456, (050)123456, 050123456 and
> > > adding new ones is simple.
> > >
> > > It's available from: http://amir.hardon.co.il/cells/kabc-updatecells.sh
> >
> > I think the following pipe is quicker and better solution.
> >
> > sed -e
> > "s/\([^0-9]0\|^0\)\([56][0-8]\)\([-)]\{0,1\}\)\([0-9]\{6,6\}\)\([^0-9]\|$
> >\) /\1|\2|\3|\4|\5/g" | \ sed -e
> > "s/|50|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/50\15\2/g"  \
> >     -e "s/|51|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/50\17\2/g"  \
> >     -e "s/|56|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/50\16\2/g"  \
> >     -e "s/|68|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/50\18\2/g"  \
> >   \
> >     -e "s/|5\([247]\)|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/5\1\2\1\3/g"\
> >   \
> >     -e "s/|5\([38]\)|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/52\2\1\3/g"  \
> >     -e "s/|6\([45]\)|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/52\2\1\3/g"  \
> >   \
> >     -e "s/|5\([5]\)|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/54\2\1\3/g"   \
> >     -e "s/|6\([67]\)|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/54\2\1\3/g"  \
> >   \
> >     -e "s/|\(6[0123]\)|\([^0-9|]\{0,1\}\)|\([0-9]\{6,6\}\)|/\1\2\3/g"  #
> > restore 06[0123] numbers
> >
> >
> > The first `sed' changes the (old) cell number to |[56]n|.|nnnnnn|,
> > The second `sed' (with its 10 expressions) converts the old numbers to
> > the new ones and omit the extra formatting characters.
> >
> > The separation allows easy selection of other number formats.
> > e.g. to allow the +972[- ][56]n... format, ONLY the first `sed' should
> > be changed, to:
> > sed -e "s/\([^0-9]0\|^0\|+972[
> > -]\{0,1\}\)\([56][0-8]\)\([-)]\{0,1\}\)\([0-9]\{6,6\}\)\([^0-9]\|$\)/\1|\
> >2| \3|\4|\5/g" |
> >
> > Ehud.
> >
> >
> > - --
> >  Ehud Karni           Tel: +972-3-7966-561  /"\
> >  Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
> >  Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
> >  http://www.mvs.co.il  FAX:  1-815-5509341  / \
> >  GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry
> > -----BEGIN PGP SIGNATURE-----
> > Comment: use http://www.keyserver.net/ to get my key (and others)
> >
> > iD8DBQFAqisGLFvTvpjqOY0RAilfAKCJRFIStBGp8g7PXi0/AVJvNofyPwCghMxH
> > iZJhhizsmSk0VbgJNhXARB0=
> > =UnaH
> > -----END PGP SIGNATURE-----
>
> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to