This question is similar to How to show lines after each grep match until other specific match? thus answers may be similar to those there.
I am trying to grab and extract from a file the lines that are after the lines that are matching a TARGET value ("forms=2", in my case) and the next empty line. The segment of my file is like below:
forms=1
Code=00416T0
Code=00416T0
forms=2 #Target**
Code=06538T0 #grab this line
Code=06538T0 #grab this line
Code=11288T0 #grab this line
Code=11288T0 #grab this line
forms=1
Code=00549T0
Code=00549T0
Code=00549T0
forms=2 #Target**
Code=00553T0 #grab this line
Code=02576T0 #grab this line
Code=02576T0 #grab this line
forms=1
Code=11099T0
So I would like to find a way according to Target "forms=2" to have the following lines even if same of those grabbing lines are identical
Code=06538T0 #grab this line
Code=06538T0 #grab this line
Code=11288T0 #grab this line
Code=11288T0 #grab this line
Code=00553T0 #grab this line
Code=02576T0 #grab this line
Code=02576T0 #grab this line
Any help please?