in reply to Re^2: grep -A10 oneliner?
in thread grep -A10 oneliner?
The second is a little trickier:
In this case, it will print 10 lines after the match.
Update: so tricky, in fact, that you can't do it with the range operator. So there's no point in using $.. So you just do
or any of the other solutions here. Sigh.perl -ne 'print if$c=/pattern/?11:$c&&$c-1'
perl -ne 'print if(/pattern/?$c=10:$c--)>0'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: ...in 43 chars
by gam3 (Curate) on Apr 14, 2005 at 21:54 UTC |