“grep -R”替代品?
我有一台安装了 grep
的机器,但选项 -R
未编译,也没有替换开关。
我怎样才能在bash中替换它?
我尝试过:
for i in `find *`; do
grep 'pattern' $i;
done
但这不是正确的重新解释,不是吗?
I have a machine with grep
installed but option -R
is not compiled-in and there is also no replacement switch.
How can I replace it in bash?
I tried:
for i in `find *`; do
grep 'pattern' $i;
done
but that is not right re-interpretation, isn't it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将
find
的输出通过管道传输到xargs
,以便grep
仅被调用几次(xargs
不断读取输入直到它变得太多以至于更多的内容无法放入参数列表中):Try piping the output of
find
toxargs
so thatgrep
only gets invoked a few times (xargs
keeps reading input until it gets so much that more would not fit in an argument list):我们通常使用
它的工作方式通常与
grep -R
类似。We usually use
That usually works similarly to
grep -R
.