January 2003
Intermediate to advanced
832 pages
32h 40m
English
wc
wc [options] [files]
Prints byte, character, word, and line counts for each file. Prints a
total line for multiple files. If no
files are given, read standard input. See other
examples
under ls and sort.
-c
Print byte count only.
-l
Print line count only.
-m
Print character count only.
-w
Print word count only.
Count the number of users logged in:
who | wc -lCount the words in three essay files:
wc -w essay.[123]Count lines in the file named by variable $file (don’t display the filename):
wc -l < $file