wc reports lines, words, and bytes for one or more files, or reads equivalent input from standard input when no filenames are supplied. section 6.0
Its command-line behavior includes:
- Formats each count in an eight-character-wide column followed by the filename. section 6.1.3
- Adds a total row when multiple files are counted. section 6.0
- Accepts flags for selected character, line, and word columns; splitting on spaces provides an approximate word count. section 6.1.3 section 6.4
Files and pipelines
wc fox.txt produces 1 line, 9 words, and 45 bytes. Multiple files produce individual rows and a total; piping grep output into wc counts the matching stream. section 6.1.3 section 6.0
$ ./wc.py ../inputs/const.txt ../inputs/sonnet-29.txt
865 7620 44841 ../inputs/const.txt
17 118 661 ../inputs/sonnet-29.txt
882 7738 45502 total
Compare per-file counts with the aggregate total in a concrete terminal listing. section 6.0

