home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: wall Chapter 2
UNIX Commands
Next: Reference: what
 

wc



wc

 [

options

] [

files

]

Print a character, word, and line count for files . If no files are given, read standard input. See other examples under ls and sort .

Options

-c

Print character count only.

-l

Print line count only.

-w

Print word count only.

Examples

Count the number of users logged in:



who | wc -l

Count the words in three essay files:



wc -w essay.[123]

Count lines in variable $file (don't display filename):



wc -l <$file


Previous: Reference: wall UNIX in a Nutshell: System V Edition Next: Reference: what
Reference: wall Book Index Reference: what

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System