Subject: bug#26254: grep's -m breaks -A

From: Paul Eggert <[email-masked]>
Date: Sat, 17 Jun 2017 20:24:03 -0700

Jim Meyering wrote:
> What do you think, Paul? Switch the default and add an option for the
> current-default `--max-count=N`-trumps-`--context=N` behavior?

I am becoming inclined to change the behavior. That is, grep should consider 
--max-count=NUM to mean "only the first NUM matching lines count, as far as 
matches go". Any remaining lines do not match, by this definition.  This would 
change the behavior in the way that's being requested.

This would also change the meaning of grep -v --max-count=NUM, since NUM would 
count matches (which is what grep --help says) rather than non-matches. This 
would make grep and grep -v inverses as they probably should be even when -m is 
used.