wc(C)


wc -- count words, lines, and characters or bytes

Syntax

wc [ -lw ] [ -c | -m ] [ file ... ]

Description

The wc command counts newline characters, words and characters in the named files. It reads from the standard input if no files are named. wc also keeps a total count for all named files. A word is a maximal string of characters delimited by white space as defined by the current locale.

The options -l, -w, and -c or -m may be used in any combination to specify that a subset of newline characters, words, and bytes or characters (respectively) are to be reported. The default options are -lwm.

The order and number of output columns are not affected by the order and number of options. There is always at most one column in the following order: number of newline characters, words, bytes, and filename. The filename is not present if one or no filename is given on the command line.

If more than one filename is given on the command line, the final line contains the total number of newline characters, words and bytes in all files, and is labeled with the word total in the filename column.

Limitations

The -c option formerly stood for character count. This can be misleading as it actually counts bytes; this may not be the same as the number of characters for some locales. Use the -m option to count characters.

Standards conformance

wc is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005