I have to get lines between two marker patterns where the ending pattern has to be present in the third column only. The same ending pattern can be present in the first column as well but have to ignore this case & continue printing till the pattern is found in third column.
for example if the contents are like below & marker patterns are "start" & "stop" in the 3rd column
>Line1
>Line2 now stop
>start
>Line3
>Line4
>stop
>Line6
>Line7 now stop
>Line8
The output should be
Line3
Line4
stop
Line6
to get the lines between two patterns i found thisawk '/start/{flag=1;next}/stop/{flag=0}flag' input.txt
but that's doesn't apply in my case.Any hints how it can be done through awk or sed. Thanks in advance.
Editing my question as i came across a special case. If there are multiple occurences of the stop pattern & there is one occurence before the start pattern. How to handle this situation. I have changed the input above to include this case.