wc(1)
NAME
wc − word, line, and character count
SYNOPSIS
wc [-lwc] [names]
DESCRIPTION
wc counts lines, words, and characters in the named files, or in the standard input if no names are specified. It also keeps a total count for all named files. A word is a maximal string of characters delimited by spaces, tabs, or new-lines.
The l, w, and c options can be used in any combination to specify that a subset of lines, words, and characters are to be reported. The default is -lwc.
When names are specified on the command line, they are printed along with the counts.
EXAMPLES
The command:
wc-wfile1
prints the number of words in file1.
The following is printed when the above command is executed:
n file1
where n is the number of words in file1.
EXTERNAL INFLUENCES
Environment Variables
LC_CTYPE determines the range of graphics and space characters.
LANG determines the language in which messages are displayed.
If LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, wc behaves as if all internationalization variables are set to "C". See environ(5).
International Code Set Support
Single-byte character code sets are supported.
WARNINGS
wc counts the number of new-lines to determine the line count. If an ASCII text file has a final line that is not terminated with a new-line character, the count will be off by one.
If an input file contains a large number of characters, words, and/or lines, the output may be hard to read. This is because wc reserves a fixed column width for each count.
STANDARDS CONFORMANCE
wc: SVID2, XPG2, XPG3, POSIX.2
Hewlett-Packard Company — HP-UX Release 9.03: April 1994