I am trying to follow the advice in past SO posts:
Find and replace with sed in directory and sub directories
and
awk/sed: How to do a recursive find/replace of a string?
but I'm getting an error with the following:
grep -r tmp_c . | xargs sed -i ’s/tmp_c/tmp_c_TEST/g’
And this is producing the following error:
sed: -e expression #1, char 1: unknown command: `?'
I'm not getting anything especially helpful when googling this. Is there some kind of file I might have in my directory that would prompt this sort of error? What else should I investigate?
grep -lr tmp_c . | xargs sed -i 's/tmp_c/tmp_c_TEST/g'
– anubhava Sep 12 '16 at 21:29grep -r
will output the lines with the matches, not just the filenames. You should be usinggrep -rl
, like in the questions you references. – Barmar Sep 12 '16 at 21:40’s/tmp_c/tmp_c_TEST/g’
should be's/tmp_c/tmp_c_TEST/g'
(no smart quotes). – melpomene Sep 12 '16 at 22:05