wc

count of newlines, words, bytes, and characters

Command


SYNOPSIS

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


DESCRIPTION

wc counts the number of newlines, words, characters and bytes in text files. If you specify multiple files, wc produces counts for each file, plus totals for all files. If you did not specify any options, wc produces the following output:
newline_count word_count byte_count filename
When you specify options, wc displays only the selected counts in the same order as the default output. If you specify -m, the character count replaces the byte count. For example, -cw displays the word count followed by the byte count and the file name and -ml displays the newline count followed by the character count and file name.

A word is considered to be a character or characters delimited by white space.
Note:

The -c option of wc counts bytes, not characters. This is a change from previous versions of wc, dictated by the POSIX.2 standard which provides the -m option to count characters. If you have a file containing multibyte characters, the byte count is higher than the character count.

Options

-c

displays a byte count. You cannot specify this option with -m.

-l

displays a newline count.

-m

displays a character count. You cannot specify this option with -c.

-w

displays a word count.


DIAGNOSTICS

Possible exit status values are:
0

Successful completion.

1

Failure because of an inability to open the input file.

2

Failure because of an invalid command line option.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0.


SEE ALSO

Commands:
awk, ed, vi


Updated MKS Toolkit [3khat16.ico]HP3000 [3khat16.ico]3kMail [archive16.gif]