bug-grep
[Top][All Lists]
Advanced

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

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


From: Paul Eggert
Subject: bug#26254: grep's -m breaks -A
Date: Sat, 17 Jun 2017 20:24:03 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

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.





reply via email to

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