8.1 Working With Files
Syntax
wc [options] file
Common Options
-c count bytes
-m count characters (SVR4)
-l count lines
-w count words
If no options are specified it defaults to "-lwc".
Examples
Given the file users:
jdoe John Doe 4/15/96
lsmith Laura Smith 3/12/96
pchen Paul Chen 1/5/96
jhsu Jake Hsu 4/17/96
sphilip Sue Phillip 4/2/96
the result of using a wc command is as follows:
% wc users
5 20 121 users
The first number indicates the number of lines in the file, the second number indicates the number of words in the file, and the third number indicates the number of characters.
Using the wc command with one of the options (-l, lines; -w, words; or -c, characters) would result in only one of the above. For example, "wc -l users" yields the following result:
5 users