[Top][All Lists]

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

Re: wc feature request

From: Kaz Kylheku (Coreutils)
Subject: Re: wc feature request
Date: Tue, 06 Oct 2020 11:19:07 -0700
User-agent: Roundcube Webmail/0.9.2

On 2020-10-05 08:40, A B wrote:
Many thanks for all the much needed contributions to society as a whole.

I did have one feature to request for wc, which I think would be
highly complementary to grep’s -q flag. It would be really cool if wc
could have a -q flag as well, which could return matches within a
predefined threshold as the exit code itself. So for example, if I
wrote ‘wc -l -q’ at the end of a pipe, then no output would be
returned, but the exit  code would return a 3 if three lines were

I don't see this exact feature in the documentation of GNU grep.
grep terminates with a 0 status (success) when matches are found,
and this is true with -q.

The idea has limited applicability; there are only as few as 8 bits
(or fewer?) available in the process status word for encoding the
exit code.

It could be useful for counting the number of lines or characters
in files that are somehow guaranteed to be small.

The inversion of the exit success polarity is also troubling.
If nothing is counted, that's 0 (success), whereas if anything
is counted, that is a termination failure.

reply via email to

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