sed: can't read : No such file or directory

我的梦境 提交于 2019-12-23 10:09:27

问题


I am running the following command:

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

where the file structure looks like this:

./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 comes back saying the files could not be found, even though these two commands work fine on their own (i.e. I can run a find by itself, and I can run sed by itself fine).

I had a peer look at it with me, and he was stumped also. I ended up going a different route, but I'd still like to know what exactly is going wrong here.


回答1:


Thanks to glenn jackman for the advice:

I needed to place quotes around the brackets as such:

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

Rather than how I initially posted it.



来源:https://stackoverflow.com/questions/22716187/sed-cant-read-no-such-file-or-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!