wc

v0.0.26
wc [OPTION]... [FILE]...

Display newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input.

Options

--bytes, -c

print the byte counts

--chars, -m

print the character counts

--files0-from=<F>

read input from the files specified by
NUL-terminated names in file F;
If F is - then read names from standard input

--lines, -l

print the newline counts

--max-line-length, -L

print the length of the longest line

--total=<WHEN>

when to print a line with total counts;
WHEN can be: auto, always, only, never

--words, -w

print the word counts

Examples

Count all lines in a file:

wc --lines {{path/to/file}}

Count all words in a file:

wc --words {{path/to/file}}

Count all bytes in a file:

wc --bytes {{path/to/file}}

Count all characters in a file (taking multi-byte characters into account):

wc --chars {{path/to/file}}

Count all lines, words and bytes from stdin:

{{find .}} | wc

Count the length of the longest line in number of characters:

wc --max-line-length {{path/to/file}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.