diff options
author | Pádraig Brady <P@draigBrady.com> | 2022-06-26 00:27:06 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2022-09-26 15:04:56 +0100 |
commit | ce2b875cd725d8d64aae5b1f250382f3fa987593 (patch) | |
tree | 981b8a836395a7879424c83348037418346cbbf8 /tests/local.mk | |
parent | 627c9a97c1054afdbe6870f3b64d42e7fccaf9eb (diff) | |
download | coreutils-ce2b875cd725d8d64aae5b1f250382f3fa987593.tar.gz |
wc: add --total={auto,never,always,only} option
without this option, control of when the total is output
is quite awkward. Consider trying to suppress the total line,
which could be achieved with something like:
wc-no-total() { wc "$@" /dev/null | head -n-2; }
As well as being non obvious, it's also non general.
It would give a non failure, but zero count if passed a file on stdin.
Also it doesn't work in conjunction with the --files0-from option,
which would need to be handled differently with something like:
{ find files -print0; printf '%s\0' /dev/null; } |
wc --files0-from=- |
head -n2
Also getting just the total can be awkward as file names
are only suppressed when processing stdin, and
also a total line is only printed if processing more than one file.
For completness this might be achieved currently with:
wc-only-total() {
wc "$@" |
tail -n1 |
sed 's/^ *//; s/ [^ 0-9]*$//'
}
* src/wc.c: Add new --total option.
* tests/misc/wc-total.sh: New test suite for the new option.
* tests/local.mk: Reference the new test.
* doc/coreutils.texi (wc invocation): Document the new option.
* THANKS.in: Add suggestor.
* NEWS: Mention the new feature.
Diffstat (limited to 'tests/local.mk')
-rw-r--r-- | tests/local.mk | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/local.mk b/tests/local.mk index 0496c2873..895797bf9 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -280,6 +280,7 @@ all_tests = \ tests/misc/wc-nbsp.sh \ tests/misc/wc-parallel.sh \ tests/misc/wc-proc.sh \ + tests/misc/wc-total.sh \ tests/misc/cat-E.sh \ tests/misc/cat-proc.sh \ tests/misc/cat-buf.sh \ |