in reply to Re: grep -A10 oneliner?
in thread grep -A10 oneliner?

Doesn't work. It only displays the matches.

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

>type !.txt a b c d e f g h pattern j k l pattern 1 2 3 4 5 6 7 8 9 10 A >perl -ne "next unless /pattern/;print scalar <> for 1..10;last" !.txt j k l pattern 1 2 3 4 5 6

I expected:

pattern j k l pattern 1 2 3 4 5 6 7 8 9 10