On Mon, Sep 12, 2022, 14:53 Pádraig Brady <p...@draigbrady.com> wrote:
> On 12/09/2022 10:20, David Pinto wrote: > > On Sun, 26 Jun 2022 at 00:49, David Pinto <carandraug+...@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. > Good arguments. +1 >