At 2:05 PM +0100 5/1/02, David Cantrell wrote:
>On Tue, Apr 30, 2002 at 03:40:20PM -0700, Palit, Nilanjan wrote:
>>  This is really a unix question, but I thought I'll ask it here, in case
>>  there is a perl tool to do the same:
>>
>>  Is there an (easy) way of doing a grep with a 'context', i.e. grep will
>>  provide the previous N & next M lines for every line that matches the
>>  pattern (where N & M are arguments to the command)?
>
>No.  You could lash something up by making grep spew out line numbers and
>then feeding them to awk.

Depends on the version of grep.

OPTIONS
        -A NUM, --after-context=NUM
               Print NUM lines of trailing context after  matching
               lines.

        -B NUM, --before-context=NUM
               Print NUM lines of leading context before  matching
               lines.

-- 

Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
[EMAIL PROTECTED]

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

Reply via email to