DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Working with files and directories

Finding out how much text is in a file

The wc(C) command counts the number of lines, words, and characters in a file, using the options -l, -w, or -c respectively. For example, to print the number of characters and lines in a file called myfile, execute the following command:

   $ wc -cl myfile
       32675  684  myfile
The order in which you specify the options determines the order of the output.

You can also give wc a list of files to count:

   $ wc chap1 chap3
       105    676   3844 chap1
       675   3869  24269 chap3
       780   4545  28113 total
The total line gives sums for the lines, words and characters in the two files, chap1 and chap2.
Next topic: Looking at the beginning and end of a file
Previous topic: Looking at the contents of a file

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005