Re: Slightly OT: How to grep for two different things in a file

From: grarpamp <grarpamp_at_gmail.com>
Date: Thu, 08 Sep 2022 02:45:26 UTC
> awk '/pattern1/ {next} /pattern2/ {print FILENAME}' somefile.txt

If pat1 is not, but pat2 is, it will still print... undesired.

pcregrep will do multiline, but since you don't know
the appearance order or buffer distance, and if you may
not want to read the entire files off media twice, or wish
to keep execs down, etc... you may be left with using python
or perl or whatever else to check each lines for the pats,
set match flags, and when both set, print exit.

Guilty parties above will learn some better ways here...
https://www.idallen.com/topposting.html