Wednesday, October 24, 2007

Search and Replace

Search and Replace (and destroy!) for file in *.*; do sed 's/Procedures.html/Procedures.php/g' $file > tmp.$file; [ -s tmp.$file ] && mv tmp.$file $file; done

Or superior:
find ./ -type f -exec sed -i ’s/string1/string2/’ {} \;

1 comment:

Greg said...

http://www.jonasblog.com/2006/05/search-and-replace-in-all-files-within-a-directory-recursively.html

Pyjamas