了解 xargs 中的递归 grep

发布于 2024-07-26 19:38:53 字数 282 浏览 4 评论 0原文

以下两个命令之间有什么实际区别?

命令 A

find . -type f -print0 | xargs -0 grep -r masi       

命令 B

find . -type f -print0 | xargs -0 grep masi 

简而言之,命令 A 的实际好处是什么?

What is the practical difference between the following two commands?

Command A

find . -type f -print0 | xargs -0 grep -r masi       

Command B

find . -type f -print0 | xargs -0 grep masi 

In short, what is the practical benefit of Command A?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你又不是我 2024-08-02 19:38:53

None .. -r 用于递归搜索目录,但 -type f 将阻止 find 返回目录名称。

None .. -r is for recursively searching directories, but the -type f will prevent find from returning directory names.

末蓝 2024-08-02 19:38:53

我认为没有
A 将尝试递归文件名(因为 find 仅搜索文件),因此它不会递归到任何内容......

I think none
The A will try to recurse over file names (as the find is only searching for files) so it will not recurse into anything...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文