Thank you for your respond,
Yes you are right not the pattern gets diplayed, it get displayed the 2'nd row after matching the pattern.
The script works fine, I need only a small tweak if it's possible. The filename get's duplicated as follows:
file1.txt 0
file1.txt 2'nd row after pattern...
awk '/ pattern/ {show[NR+2]++} show[NR]' *.txt
The above code search for pattern in several text files and when pattern is found than prints the 2'nd row after.
How do I add the filename to be printed in the same line with the pattern?
Thanks in advance
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.