[geeks] search and replace

Mike Meredith mike at blackhairy.demon.co.uk
Fri Sep 5 14:04:55 CDT 2003


On Fri, 5 Sep 2003 13:27:26 -0500
"Joshua D. Boyd" <jdboyd at celestrion.celestrion.net> wrote:
> On Fri, Sep 05, 2003 at 02:04:47PM -0400, Kurt Huhn wrote:
> 
> > sed s/pic.gif/"images/pic.gif"/g
> > will probably get you there.  Unless I've typo'd something, that
> > is....
> 
> That takes care of one file you still have to apply it to all of them.

find . -name \*html -print | \
	awk '{printf "sed -e s/pic\.gif/images\/pic.gif/g %s | cat 
	> %s", $1, $1}' > do
chmod +x do
./do

You could do that all in one go without the 'do' shell script, but I've
picked up the habit of being cautious from somewhere (hands up everyone
who has tried 'sed -e something file > file' ?).



More information about the geeks mailing list