file test contains the following lines. between the lines ABC there may be any amount of lines up to the next ABC entry.
I want to grep for the filename.txt entry and print the lines in between (and including that line) up to and including the last line before the next ABC
I want do this so I could also specify filename3.txt and get all 4 lines in between.
All help much appreciated.
ABC 4 5 filename.txt 3
line 1 2 3 4 5
line 1 2 3 4 5
ABC 4 5 filename2.txt 5
line 1 2 3 4 6
ABC 6 6 filename3.txt 6
line 1 2 3 4 5
line 3 4 5 6 7
line 5 6 6 7 8
line 4 3 2 1 3
ABC 4 3 filename44.txt 5
any ideas?
---------- Post updated at 04:15 PM ---------- Previous update was at 03:40 PM ----------
Think I've got it
awk '/string_to_search/ {a=1;next} /ABC/{f=0} f {print}'