How can I grep a directory for lines that contain "Foo", but only get matches when the next line also contains "Bar"?
How to grep a directory based on the contents of two successive lines
grepregular expression
grepregular expression
How can I grep a directory for lines that contain "Foo", but only get matches when the next line also contains "Bar"?
Best Answer
@warl0ck pointed me in the right direction with
pcregrep
, but I said "contains", not "is", and I asked about a directory, not a file.This seems to work for me.