in reply to Grepping surrounding lines, is this redundant?

That this doesn't already exist as a standard UNIX tool ( I figure there must be).

GNU grep

grep -3 -C [NUM], -NUM, --context[=NUM] Print NUM lines (default 2) of output context. grep -A3 -A NUM, --after-context=NUM Print NUM lines of trailing context after matching lines. grep -B3 -B NUM, --before-context=NUM Print NUM lines of leading context before matching lines.
Update:
If by the incredible chance it doesn't, should I submit it as a patch?

Submit a patch regardless. :-)

    --k.


Replies are listed 'Best First'.
Re: Re: Grepping surrounding lines, is this redundant?
by shotgunefx (Parson) on Apr 14, 2003 at 07:42 UTC
    Thanks.
    Duh! I can't believe I never saw that. I knew it had to be long done already. I did do some googling put apparently I wasn't looking for the right terms. Oh well. I will polish it regardless as I do like the way I have the numbering set up. (It can number the lines -N - 0 (match)- N+ which I happen to like)
    ##############################
     -5:
     -4:use 5.006;
     -3:use strict;
     -2:use warnings;
     -1:
      0:use constant PREFIX => '_Branch_';
      1:
      2:use HTML::Parser;
      3:use HTML::Tagset;
      4:use Data::Dumper;
      5:
    ##############################
    


    -Lee

    "To be civilized is to deny one's nature."