in reply to Print Lines above and below string
wgrep.pl as listed at this link will do it.
http://www.unix.com/solaris/33533-grep-display-few-lines-before-after.html
Or just use grep at the command line or qx() with the -B and -A options to specify the number of lines before and after.
|
---|