I have tried this awk command, but for some reason it is not printing out the data between two patterns
This is my entire awk command
for file in `cat out.txt`
do
awk -v ff="$file" 'BEGIN {print "Start Parsing for"ff} /ff-START/{flag=1; next}/ff-END/{flag=0}flag; END{print "End Parsing"ff}' data.txt
done
This is the content of data.txt
JOHN SMITH-START
Device,Number
TV,1
Washing Machine,1
Phones, 5
JOHN SMITH-END
MARY JOE-START
Device,Number
TV,3
Washing Machine,1
Phones, 2
MARY JOE-END
and there are 100 more similar lines here the patterns is NAME-START and NAME-END. So for eg JOHN SMITH-START is the first pattern and then JOHN SMITH-END is the second pattern, and I want to extract the data between these two which is
Device,Number
TV,1
Washing Machine,1
Phones, 5
But the output I get is
Start Parsing forJOHN SMITH
End ParsingJOHN SMITH
Content of out.txt is
JOHN SMITH
MARY JOE