Hi,
I have a text file, which I am trying to parse.
File contents:
BEG
Id Job1
Id Stage1
1
EN
Id Job2
Id Stage2
BEG
Id2 Job3
Id Stage4
2
EN
I have to process the data in this between every BEG and EN. so I am trying to restrict the range and inside every range, Is there a way to define another range like below..
awk '/BEG/,/EN/ {
/BEG/,/ID/ {print $2}}' file
The reason is that there are so many lines with same keyword, I just need the very first one.
And also there are many subsets inside BEG and EN (not shown in sample file) so I need to process the lines between these in groups inside every BEG and EN which would be easier if there was a way to recursively define pattern rangers inside awk.
Thanks.