Shell Tip: Search and Replace in line

Replace the word “Cat” by “Pony” in all the files of the current directory and subdirectories:

a=Cat; grep -lr $a . | xargs perl -pi -e s/$a/Pony/g