I’ve been at this for hours and for some reason, I cannot find out why this command will not replace the desired string. I’m trying this
grep -r -l 'first\.second\.third\.fourth' . | xargs -i -e sed's/first\.second\.third\.fourth/foo\.bar\.fooey/g'
so what I’m trying to do is recursively search through a folder with lots of files and change "first.second.third.fourth" to "foo.bar.fooey". After I run the grep and sed command, I grep again to make sure that “first.second.third.fourth” isn’t found but it comes up, what I believe is just as many times. So I’m pretty much at my wit’s end.
Any help would be greatly appreciated. Thanks everyone.
The
-ishould be an argument to sed, not to xargs. And as @potong points out, the “.” characters in sed’s match string must be escaped, or they’ll match anything.