Let's assume the following file:
delimiter_1
1
2
delimiter_22
blah
blah blah
delimiter_3
3
2
delimiter_2
The goal is to extract all lines between and including 'delimiter_3' and 'delimiter_2' to get:
delimiter_3
3
2
delimiter_2
This can be done with:
awk "/^delimiter_3$/{a=1};a;/^delimiter_2$/{exit}" file
However, if 'delimiter_2' is repeated such as:
delimiter_1
1
2
delimiter_2
blah
blah blah
delimiter_3
3
2
delimiter_2
the previous awk command returns an empty result.
Is this an issue with the command or awk?
P.S: I've noticed some other similarly worded questions, but AFAIK, none of them covers the exact same use-case.
EDIT: I've replaced all mentions of 'pattern' with 'delimiter'.