sed: can't read book/: 没有那个文件或目录 [英] sed: can't read book/ : No such file or directory
本文介绍了sed: can't read book/: 没有那个文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Red Hat Enterprise Linux Server 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
其实我可以跑
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
一个查找文件的选项时,他们真的搞砸了.有一个非常好的 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: can't read book/: 没有那个文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文