On Fri, Feb 27, 2026 at 4:50 AM Chris Green wrote:
>
> I know and use grep extensively but this requirement doesn't quite fit
> grep.
>
> I want to search lots of diary/journal entries (which are just plain
> text files) for entries which have two or more specified strings in
> them.
>
> E.g. I'm looking for journal entries which have, say, the words
> 'green', 'water' and 'deep' in them. Ideally the strings searched for
> could be Regular Expressions (though simple command line type wild
> cards would suffice).
>
> Is there a tool out there that can do this?
AWK
The trick being to set the record seperator (RS) to whatever delimits
a single journal entry .. like a null line, so multiple lines are
treated as a single record.
for example
$ cat journal.txt
The green fox
jumps over the
red dog.
The green fox
jumped over the
deep barrel full
of water.
The brown dog
jumped over the
deep barrle full
of water.
$ awk -v RS="" '/green/ && /water/ && /deep/ {print $0}' journal.txt
The green fox
jumped over the
deep barrel full
of water.
Regards
Lee