Imagine the following file structure:
foo.bar.1 blabla moreblabla relevant=yes foo.bar.2 relevant=no foo.bar.3 blablabla foo.bar.4 relevant=yes
I want to retrieve all
foo.bar lines where within the block following themselves and before the next
foo.bar there is a line stating
So the output should be:
I could of course write a program/script iterating through the lines, remembering the
foo.bars and print them when there is a line saying
relevant=yes following them an before the next
foo.bar. But I thought there might be an out-of-the box way using standard Unix utilities (grep/sed/awk)?
Thanx for any hints!