How to find patterns across multiple lines using grep?

Posted by Saobi on Stack Overflow See other posts from Stack Overflow or by Saobi
Published on 2010-04-21T19:58:39Z Indexed on 2010/04/21 20:03 UTC
Read the original article Hit count: 342

Filed under:
|
|

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 blah..
blah blah..
blah abc blah
blah blah..
blah blah..
blah blah..
blah efg blah blah
blah blah..
blah blah..

Should be matched.

© Stack Overflow or respective owner

Related posts about grep

Related posts about regex