Subject: bug#70540: grep -c -r | grep -v ':0$'

From: [email-masked]
Date: Thu, 25 Apr 2024 16:48:20 -0500

Dale wrote:
> If these weren't ad-hoc activities, I would construct a careful pipeline
> like
> 
>     grep -c -r pattern directory | sort -t: -k2,2r | head -n3
> 
> but for ad-hoc use, it seems to me that it's sensible and convenient to
> make the combination -c -l do what it intuitively "ought" to do, given
> that that change would be upward-compatible with Posix.

When I have frequently used cases like that, and get tired of just typing it all into a shell prompt over and over, I write a little wrapper command (perhaps in C, shell, Python or some combination) that encapsulates the repetitively useful details.  My personal src and bin directories have hundreds of such commands, some dating as far back as early 1980's when I was at Bell Labs.  (Though this habit can become annoying when I am on someone else's computer, and half the command lines I type at a shell prompt fail "command not found".)

-- 
Paul Jackson
  [email-masked]