Over the years, there have been many times when I’ve needed to replace a string in thousands of files. Usually this comes from a change in some sort of output standard and we’re converting historical data to match, or worse, a typo was found in a script after output was generated. This little command has saved me many times:
cd /to/my/dir
grep -r “some_string” * | xargs sed -i ‘s/some_string/new_string/g’