Find files where 2 given words occur in

久未见 提交于 2019-12-13 00:23:20

问题


(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?


回答1:


You can just grep twice:

grep -l Peter * | xargs grep -l James

The same works with ack:

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.



来源:https://stackoverflow.com/questions/15042580/find-files-where-2-given-words-occur-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!