Sed: unable to read: no such file or directory

I run the following command:

find . -name '*.html' -exec sed "s/foo/bar/g" {} \; 

where the file structure is as follows:

 ./two/three.html ./two/two.html ./two/one.html ./three/three.html ./three/two.html ./three/one.html ./one/three.html ./one/two.html ./one/one.html 

However, sed returns, stating that the files cannot be found even if these two commands work fine (i.e. I can run the search on my own, and I can run sed on my own).

I looked at him with peers, and he was also at an impasse. I ended up going the other way, but I still would like to know what exactly is happening here.

+4
replace search sed
source share
1 answer

Thanks to glenn jackman for the tips:

I needed to place quotes around parentheses as such:

 -exec sed "s/foo/bar/g" '{}' \; 

Instead, I originally posted it.

+3
source share

All Articles