I need to replace '30 by `30 in a bunch of files. The following does not work:
grep -Rl "'30" /myDir | xargs sed -i "s/'30/`30/g" How do I fix it?
I am on a Fedora 26 machine.
Just add a backslash before the backtick:
grep -Rl "'30" /myDir | xargs sed "s/'30/\`30/g" sed -i... find /myDir -maxdepth 1 -type f -exec grep -q \'30 {} \; -exec sed -i -e y/\'/\`/ {} + Here you allow find to filter the files, in the directory /myDir, carrying the string ,'30, and pass only those, in a bunch, to sed, which'll do an in-place editing-i` on them.
tr "'" '`'instead of sed