Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email 



COUNTING WORDS ( The "wc" command )


There are people that love to count beans, myself at the end of the day I love to count the words I have written. <g>
And sure, Linux has just the command for that: "wc"

The "wc" command comes with a few options:

QUOTE
-c, print the byte counts
-m, print the character counts
-l, print the new line counts
-L, print the length of the longest line
-w, print the word counts


When I execute the command on this little bit of text I am typing right now I get:

Words:
CODE
$ wc -w test.txt
184 Desktop/text.txt


Lines:
CODE
$ wc -l test.txt
50 Desktop/text.txt


Characters:
CODE
$ wc -m test.txt
1045 Desktop/text.txt


Longest line:
CODE
$ wc -L test.txt
118 Desktop/text.txt



Sure you can feed the "wc" command more then one file in a different format at once:
CODE
$ wc -w test.txt xgl.doc NewTips.txt post.kwd
 184 test.txt
 280 xgl.doc
 209 NewTips.txt
1161 post.kwd
1834 total



And here is one to try at home . . . . cd to your Documents folder and do "wc -w *.odt" ( or "wc -w *.doc" if that is your preferred format )

Isn't that fun . . . . . . at least you get the impression you weren't all that lazy after all  . . . .



Bruno



-- Oct 1 2006 --


Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email