查找出现2个给定单词的文件 [英] Find files where 2 given words occur in
本文介绍了查找出现2个给定单词的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
(如何)我是否可以找到在同一文件中出现2个单词的文件,例如 Peter
和 James
? ack-grep
是否可能?
(How) Can I find files where there are occurrences of 2 words in that same file, say Peter
and James
? Is it possible with ack-grep
?
推荐答案
您可以使用grep两次:
You can just grep twice:
grep -l Peter * | xargs grep -l James
与 ack $ c $相同c>:
ack -l Peter * | xargs ack -l James
您可以替换 *
与您可能关心的其他文件列表一起,或使用查找
为您生成一个列表。
You can replace the *
with whatever other file list you might care about, or use find
to generate a list for you.
这篇关于查找出现2个给定单词的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文