Replace all occurrences of “oldstring” with “newstring” in all files (no recursion):
perl -pi -e 's/oldstring/newstring/g' *
Replace all occurrences of “oldstring” with “newstring” in all HTML files recursively:
perl -pi -e 's/oldstring/newstring/g' `find ./ -name *.html`
Replace all occurrences of “oldstring” with “newstring” in all files recursively:
perl -pi -e 's/oldstring/newstring/g' `grep -irl oldstring *`
Replace all occurrences of “oldstring” with “newstring” in all files recursively, excluding .svn directories:
perl -pi -e 's/oldstring/newstring/g' `grep -irl oldstring * | grep -v .svn'
Taken from this blog which seems to no longer be active.