How to find patterns across multiple lines using grep?

后端 未结 26 2186
你的背包
你的背包 2020-11-22 04:14

I want to find files that have \"abc\" AND \"efg\" in that order, and those two strings are on different lines in that file. Eg: a file with content:

blah bl         


        
26条回答
  •  我在风中等你
    2020-11-22 04:19

    This should work too?!

    perl -lpne 'print $ARGV if /abc.*?efg/s' file_list
    

    $ARGV contains the name of the current file when reading from file_list /s modifier searches across newline.

提交回复
热议问题