Here’s the one-liner that I used to accomplish this task. I used it as part of a script so the values were dynamically substituted:
grep -rl '<oldString>' <path> | xargs sed -i '' 's/<oldString>/<newString>/g' $1
<oldString> is the string you want to replace
<newString> is the string you want to replace
<path> is where you want grep to start working from
Grep recursively (-r) finds the files (-l) and pipes the file path in to xargs which executes the sed command for file it receives. $1 references the file path received via xargs. This one-liner doesn’t create a backup file for every file changed, however, if you want to create a backup file as well in the same directory as the file changed, you can use the following, slightly different one-liner:
grep -rl '<oldString>' <path> | xargs sed -i.bak 's/<oldString>/<newString>/g' $1
If I knew grasp well, I’d have used that instead, but for now, grep and sed are good enough.