[EMAIL PROTECTED] wrote:
[...]
I want to print a line which contain a string with 4 lines above 6 lines below 
to an output file. Here is the example:
[...]


If you have GNU grep:


grep -B4 -A6 dock filename


Otherwise:

awk '{ x[FNR] = $0 }
f && f--
/doc/ { for (i=FNR-4; i<=FNR; i++)
  print x[i]
split("",x)
f = 6 }'  filename


Regards
Dimitre


_______________________________________________
Solaris-Users mailing list
[email protected]
http://www.filibeto.org/mailman/listinfo/solaris-users

Reply via email to