:
: i have a lot of HTML files with the code
: <body bgcolor=white>
:
:
: i would like to change this line to
: <body bgcolor=FFFFFF>
:
: the files are dispersed in a variety of directories...is there
: a way to find and replace the "white" for "FFFFFF" in all these
: files? i heard it could be done with the sed command somehow??
:
With apologies to _real_ shell programmers, the following script
should do the trick:
#!/bin/bash
for dir in <list full path names of all html directories here>; do
cd $dir
for afile in $(ls); do
if [ -f $afile ] && grep -q '<body bgcolor=white>' $afile; then
sed 's/<body bgcolor=white>/<body bgcolor=FFFFFF>/g' > $afile.temp
mv $afile.temp $afile
fi
done
done
No warranties, mind...
--
William Webber Postgrad. Dip. in CS, RMIT, Australia
"Well, I'll say this for you, the quality of your stupidity is rising"
- Lucy, from Peanuts.