in reply to Regex to find/replace in a file

This can also be done on the cmd line verry easily:
perl -i.bak -lpe 's/foo/bar/g;' baz
This would replace all occurances of foo with bar in file baz backing up the original (unalterd file) to baz.bak