On the command line: grep -n5 "search_string" filename
If you want to use it in your code
my $result = `/usr/bin/grep -n5 "search_string" $file`; print $result;
In reply to Re: Print Lines above and below string
by duyet
in thread Print Lines above and below string
by coding_new
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |