The following search and replace method in unix is a clean and effecient perl script as unlike other scripts it does not generate any temporary files. This however maybe a disadvantage in some cases as it does not allow for error corrections.
Here are a few different ways to use this perl script:
Peform a Search and Replcae in all files:
perl -pi -e 's/SEARCH/REPLACE/g' *.*
Peform a Search and Replace in all files with specific extention:
perl -pi -e 's/SEARCH/REPLACE/g' *.EXT
Perform a Search and Replace in all files in all subdirectories:
perl -i -p -e 's/SEARCH/REPLACE/g' `find | grep .htm`