I know this type of search has been address in a few other questions here, but for some reason I can not get it to work in my scenario.
I have a text file that contains something similar to the following patter:
some text here done
12345678_123456 226-
more text
some more text here done
12345678_234567 226-
I'm trying to find all cases where done
is followed by 226-
on the next line, with the 16 characters proceeding. I tried grep -Pzo
and pcregrep -M
but all return nothing.
I attempted multiple combinations of regex to take in account the 2 lines and the 16 chars in between. This is one of the examples I tried with grep
:
grep -Pzo '(?s)done\n.\{16\}226-' filename
Related posts: