GNU bug report logs - #26254
grep's -m breaks -A

Previous Next

Package: grep;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Sat, 25 Mar 2017 16:25:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>, Nicholas Sushkin <nsushkin <at> openfinance.com>
Cc: 26254 <at> debbugs.gnu.org, Stuart MacDonald <stuartm.coding <at> gmail.com>
Subject: bug#26254: grep's -m breaks -A
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.




This bug report was last modified 8 years and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.