bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grep -A -m and two following matches


From: Stepan Kasal
Subject: Re: Grep -A -m and two following matches
Date: Fri, 3 Oct 2003 09:36:26 +0200
User-agent: Mutt/1.2.5.1i

Hello,

On Fri, Oct 03, 2003 at 09:56:54AM +0300, Jori Mantysalo wrote:
> address@hidden jori]$ echo -e 'a\nb\nc\nd' | grep -A 1 -m 1 b
> b
> c
> address@hidden jori]$ echo -e 'a\nb\nb\nd' | grep -A 1 -m 1 b
> b
> 
> A bug?

the info page documents this behaviour:

     When `grep' stops after NUM matching lines, it outputs any
     trailing context lines. Since context does not include matching
     lines, `grep' will stop when it encounters another matching line.

So it's a feature!  ;-)

Yours,
        Stepan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]