following above thought I want to print the 2nd line below the pattern line but I can only pick up the 1st match line not all of them ... something is wrong please comment,
abc
def
ghi
jkl
mno
pqr
stu
abc
vwx
yza
use abc to print ghi, yza,
but I only get ghi use below ...
awk '{a[NR]=$0} /abc/ {b[NR]=NR+2} END {for (i in b); {print a[b]}}' input/file
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.