Subject: bug#39591: grep v3.4 after-context

From: Jim Meyering <[email-masked]>
Date: Fri, 21 Feb 2020 19:08:16 -0800

tags 39591 + moreinfo
stop

On Thu, Feb 13, 2020 at 8:58 AM Adams, John <[email-masked]> wrote:
> Recent greps do not behave as documented with respect to after-context.  In the past I've been accustomed to -AX meaning print X lines of after context.  That is not how gnu grep is working now, but it is how it is documented.  In fact -AX, which I tested with a v3.4 that I build on Ubuntu 18, will print X+1 lines of after-context.  If you want 1, you must say -A0.

Thanks for the report. Can you provide a stand-alone example like the
following to demonstrate the problem?
I am unable to reproduce it so far, since this prints only one line of
following context:

$ printf '%s\n' a b c d e | grep -A1 c
c
d