From: Parv <[EMAIL PROTECTED]>
To: DeepTech <[EMAIL PROTECTED]>
Subject: OT: sed usage (was Re: Search & Replace Issue)
Date: Mon, 25 Dec 2006 00:04:47 -0500
in message <[EMAIL PROTECTED]>,
wrote DeepTech thusly...
> sed -e 's/http\:\/\/www\.domain\.htm\///g' *.htm > *.htm
That will most likely destroy the original file(s).
Depending on your shell, you will get redirection error from the shell
if there happen to be more than one file matching the pattern '*.htm'.
In particular, in zsh 4.2.6 ...
# cat p
# cp -f p q; cp -f p qq
# ls -l p q*
-rw------- 1 parv people 10 Dec 24 23:32 p
-rw------- 1 parv people 10 Dec 24 23:32 q
-rw------- 1 parv people 10 Dec 24 23:32 qq
# sed -e '' q* >| q*
# ls -l q*
-rw------- 1 parv people 0 Dec 24 23:34 q
-rw------- 1 parv people 0 Dec 24 23:34 qq
> NOTE: not sure if u have to use a '\' before that ':'
No, ':' need not be escaped.
sed -e 's/http\:\/\/www\.domain\.htm\///g' *.htm > *.htm
Although it did not destroy the files, it didn't work, nor did most of the
However, this one using perl DID work perfectly:
perl -pi -e 's/http:\/\/www.cebik.com\///g' *.html
None of the other SED(1) tips worked although I tried several times.
The above is the only perl tip that worked for my purpose and it worked
Although the SED(1) tips may have worked if I had enough time to debug, time
was a factor. Glad the one worked as it saved an enourmous amount of time on
this S&R effort.
Again, many thanks for all the help!
Best & Merry Xmas!
Fixing up the home? Live Search can help
firstname.lastname@example.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"