Hi all,
I have a file that I need to scan and output data between Number and End containing string 123.
Number 1:
6
7
123
1
End
Number 2:
1
2
End
Number 3:
123
1
2
3
End
The ouput should be:
Number 1:
123
End
Number 3:
123
End
In other words, I need to see block of data when 123 is present between pattern Number and End.
Thank you! any help is appreciated.
I used awk '/Number/{s=x}{s=s$0"\n"}/123/{p=1}/End/ && p{print s;exit}' file > outputfile
but it only return first occurence.
