is there a way in bash to print lines from one match to another, unless third match is between those lines? Let's say file is:
A
B
C
D
E
A
B
Z
C
D
And I want to print all the lines between "A" and "C", but not those containing "Z", so output should be:
A
B
C
I'm using this part of code to match lines between "A" and "C":
awk '/C/{p=0} /A/{p=1} p'