in reply to grep -A10 oneliner?

perl -ne 'next unless /pattern/;($i++<10)?(print($_)):(last)' <filenam +e>

Update: ikegami is absolutely correct. Tested version that works:

-ne 'next unless /pattern/;print scalar <> for 1..10;last' <filename>

Replies are listed 'Best First'.
Re^2: grep -A10 oneliner?
by ikegami (Patriarch) on Apr 14, 2005 at 19:47 UTC

    Doesn't work. It only displays the matches.

    Update: The updated solution also fails. It doesn't support overlapping ranges.