Trying to get the "Log" line printed only if "ref1" is present in the text following the "Log" line
sample text :
Log 0102
............
.....ref1.......
......ref1....
Log 0103
............
.....ref1.......
....
Log 0104
............
.....ref2.......
......
expected result :
Log 0102
Log 0103
result i am getting:
Log 0102
Log 0102
Log 0103
i tried this awk command but not getting results:
awk '/Log*/ line =$0}/ref1/{print line}'