View Single Post
Old 05-04-2005   #7
Trev
Cunty
Want to see your own Advertising Here!
 
Trev's Avatar
 
Join Date: Jan 2003
Posts: 10,150
Default

Quote:
Originally posted by Mr Benn@May 4 2005, 11:32 AM
for i in `grep -ir olddirectory/subdir/link1.html /www/vhosts/ | cut -d":" -f1 | sort | uniq`; do cat $i | sed -e 's/olddirectory\/subdir\/link1.html/newdirectory\/newlink1.html/g' > .tmp$$; mv -f .tmp$$ $i; done

That would search all files in /www/vhosts (and all subdirectories) for the string "olddirectory/subdir/link1.html", produce a unique list of filenames with full path, replace the string you searched for with "newdirectory/newlink1.html", write the new output to a temp file, then overwrite the original file with your new one.
__________________
Sucks to be you.
Trev is offline   Reply With Quote