Quickly find/replace stuff in files

Quickly find/replace stuff in files

I had to replace a string in a bunch of files and wanted to do it quickly.
1. cd to the directory where your files live.
2. Run this:


for i in *; do perl -i -pe 's/oldtext/new better  text/g' $i; done

..or no perl? Use sed.


for i in *; do sed -e 's/oldtext/newtext/g' -i $i;  done