bug-grep
[Top][All Lists]
Advanced

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

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


From: jackson
Subject: bug#70540: grep -c -r | grep -v ':0$'
Date: Thu, 25 Apr 2024 16:48:20 -0500
User-agent: Cyrus-JMAP/3.11.0-alpha0-386-g4cb8e397f9-fm-20240415.001-g4cb8e397

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
  jackson@fastmail.fm


reply via email to

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