This little snippet replaces occurrences of oldString with newString in all files named *.txt in the current directory and below, keeping a backup of the original files.
for i in $(find . -name "*.txt"); do sed 's/oldString/newString/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
Example of replacing the svn root in a bunch of svn entry files.
ReplyDelete$ for i in `find . -name "entries"`; do sed 's/svn\.parwy\.net\/repos\/projectx/projectx-server\.host\.com\/svn/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
$ for i in `find . -name "entries"`; do rm -f $i-backup; done