Word Count: wc



next up previous contents index
Next: Pattern Search: grep Up: Unix Toolkit Previous: Sort

Word Count: wc

The wc command counts the number of lines, words, characters, or bytes. With no options, it prints out all three counts and the file name:   


wc OPTIONS
-l
Count lines.
-w
Count words.
-c
Count bytes or characters.

For example, we can obtain statistics on several Fortran files:

% wc cswap.f dogleg.f enorm.f fdjac1.f   	   
   78  329  2285   cswap.f   	Lines, words, characters, file name.   
  195  866  5667   dogleg.f   	   
  127  493  3542  enorm.f   	   
  168  795  5320  fdjac1.f   	   



next up previous contents index
Next: Pattern Search: grep Up: Unix Toolkit Previous: Sort