Today I needed to find and replace an error in 55,000 files, and decided to use grep and sed.
1) I created a sed source file with the following s/\$this/$this/g and saved it as s.sed (i’m removing the backslash in front of $this)
2) grep -rl ‘/$this’ /home/sandusky/pathtofiles/ | xargs sed -i -f s.sed
this second command looks for files in the path that contain the search term, then sed updates them for a single file you could just type it out, sed -i ‘s/find/replace/g’ < filename.ext (g for global replace all instances)