WC(1) WC(1)
wc - word, line and byte or character count
wc [ -c|-m ] [ -lw ] [ names ]
wc counts lines, words, and characters or bytes in the named files, or in
the standard input if no names appear. It also keeps a total count for
all named files, if more than one input is specified. The wc utility
considers a word to be a non-zero length string of characters delimited
by white space.
The wc utility conforms to the XBD specification in the utility argument
syntax guideline.
The following options are supported:
-c Write to the standard output the number of bytes in each input file.
-l Write to the standard output the number of newline characters in
each input file.
-m Write to the standard output the number of characters in each input
file.
-w Write to the standard output the number of words in each input file.
The options l , w , and c or m may be used in any combination to specify
that a subset of lines, words, and bytes or characters are to be
reported. The default is -lwc.
When names are specified on the command line, they will be printed along
with the counts.
The following operand is supported:
file A pathname of an input file. If no file operand is specified, the
standard input will be used.
The standard input will be used only if no file operands are specified.
See INPUT FILES.
The input files may be of any type.
Page 1
WC(1) WC(1)
ENVIRONMENT VARIABLES [Toc] [Back] The following environment variables affect the execution of wc:
LANG provide a default value for the internationalization variables that
are unset or null. If LANG is unset or null the corresponding value
from the implementation-specific default locale will be used. If any
of the internationalization variables contains an invalid setting,
the utility will behave as if none of the variables had been
defined.
LC_ALL
if set to a non-empty string value, override the values of all the
other internationalization variables.
LC_CTYPE
determine the locale for the interpretation of sequences of bytes of
text data as characters (for example, single - as opposed to multibyte
- characters in arguments).
LC_MESSAGES
determine the locale that should be used to affect the format and
contents of diagnostic messages written to standard error.
NLSPATH
determine the location of message catalogs for the processing of
LC_MESSAGES.
By default, the standard output contains an entry for each input file of
the form:
"%d %d %d %s\n", <newlines> , <words> , <bytes> , <file>
If the -m option is specified, the number of characters replace the
<bytes> field in this format.
If any options are specified and the -l option is not specified, the
number of newline characters will not be written.
If any options are specified and the -w option is not specified, the
number of words will not be written.
If any options are specified and neither -c nor -m is specified, the
number of bytes or characters will not be written.
If no input file operands are specified, no name will be written and no
blank characters preceding the path name will be written.
If more than one input file operand is specified, an additional line will
be written, of the same format as the other lines, except that the word
total (in the POSIX locale) will be written instead of a pathname and the
total of each column will be written as appropriate. Such an additional
Page 2
WC(1) WC(1)
line, if any, will be written at the end of the output.
Used only for diagnostic messages.
None.
The following exit values are returned:
0 successful completion
>0 an error occurred
PPPPaaaaggggeeee 3333 [ Back ]
|