coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] Re: wc --no-total option


From: Pádraig Brady
Subject: Re: [PATCH] Re: wc --no-total option
Date: Mon, 12 Sep 2022 13:32:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Thunderbird/98.0

On 12/09/2022 10:20, David Pinto wrote:
On Sun, 26 Jun 2022 at 00:49, David Pinto <carandraug+dev@gmail.com> wrote:
Hi

A couple of years ago [1] someone made a feature request for a wc
option that would skip the total line when processing multiple files.
I didn't see anyone commenting against it and it is something that I'm
constantly hacking with `head -n-1`.

I've attached a patch that implements a new `--no-total` option to wc.
I believe this patch to be trivial enough that I can't claim copyright
for anything.

Best regards
David

[1] https://lists.gnu.org/archive/html/coreutils/2015-11/msg00064.html

Hi

It's been almost 3 months without any reply.  I hope it's OK to bump
it again.  I've just changed the subject line to make it clear there
is a patch attached.

Thanks for the bump.

This is one of those marginal ones since
there is no extra functionality provided
by bringing the logic within the utility.

The following function would achieve the desired functionality:

  wc-no-total() { wc "$@" /dev/null | head -n-2; }

Since it's easy enough to achieve with a single extra processing step,
Given the above, I'd be 60:40 against adding a --no-total option.
But thinking more, the above is awkward to combine with the --files0-from 
option.
So you'd need a separate invocation in that case like:

  { find files -print0; printf '%s\0' /dev/null; } |
  wc --files0-from=- |
  head -n2

Even though there is still no extra functionality,
the above is starting to get a bit obtuse.

If we lifted the restriction with --files0-from
to also allow file names to be specified on the command line
(and for those to be processed after stdin),
it would mean the wc-no-total() function above would be general,
and would work for all wc invocations.

Though a --no-total option is looking more appealing
given the above considerations. I.e. that the
wc-no-total() implementation isn't obvious,
and we'd have to change wc anyway to make it general.

So I'd be 55:45 for adding this option.

cheers,
Pádraig



reply via email to

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