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.