Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Grepping surrounding lines, is this redundant?

by Kanji (Parson)
on Apr 14, 2003 at 07:28 UTC ( [id://250230]=note: print w/replies, xml ) Need Help??


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."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://250230]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found