Find files containing multiple strings

前端 未结 4 743
悲&欢浪女
悲&欢浪女 2021-01-20 08:26

I use a command to recursively find files containing a certain string1:

find . -type f -exec grep -H string1 {} \\;

I need to

4条回答
  •  旧时难觅i
    2021-01-20 08:51

    you can also try this;

    find . -type f -exec grep -l 'string1' {} \; | xargs grep -l 'string2'
    

    this shows file names that contain string1 and string2

提交回复
热议问题