sed:无法读取书籍/:没有这样的文件或目录 [英] sed: can't read book/ : No such file or directory
本文介绍了sed:无法读取书籍/:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在红帽企业Linux服务器6.6版(圣地亚哥)上运行以下一行代码
I ran the following one line code on Red Hat Enterprise Linux Server release 6.6 (Santiago)
grep -rl 'room' book/ | xargs sed -i 's/room/equipment/g'
我收到以下消息
sed: can't read book/
book/del_entry_ajax.php: No such file or directory
实际上,我可以运行
Acutally I can run
grep -rl 'room' book/del_entry_ajax.php | xargs sed -i 's/room/equipment/g'
成功,然后再次运行第一个命令,我得到了
successfully and then run the first command again, I got
sed: can't read book/
: No such file or directory
为什么会这样,我该如何解决它?
Why is that and how can I fix it?
推荐答案
GNU球员给 grep
一个选项 find 文件时真的搞砸了。有一个非常好的UNIX工具来查找文件,它有一个非常明显的名称 - find
。试试这个:
The GNU guys really messed up when they gave grep
an option to find files. There is a perfectly good UNIX tool to find files and it has a perfectly obvious name - find
. Try this:
find book -type f -print0 | xargs -0 sed -i 's/room/equipment/g'
这篇关于sed:无法读取书籍/:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文