I am trying to grep for text between expressions (say BEGIN and END ) that may not be on the same line:
perl -wln -e 'm/BEGIN.+END/s and print;' < file.txt
Please note that due to the s modifier (in m/RE/s ) "." allowed to match a new line (along with anything else).
This allows the template to combine words in a specific order with something in between (i.e., the BEGIN template is on the same line, and the END template is on the few lines below). If two patterns are on the same line, this works fine, but not when it spans multiple lines. What am I missing here?
source share