- Wc (Unix)
wc (short for word count) is a command in
Unix-like operating systems.The program reads either standard input or a list of files and generates one or more of the following statistics: number of bytes, number of words, and number of lines (specifically, the number of
newline characters). If a list of files is provided, both individual file and total statistics follow.Sample execution of wc:
$ wc ideas.txt excerpt.txt 40 149 947 ideas.txt 2294 16638 97724 excerpt.txt 2334 16787 98671 total
The first column is the count of newlines, the second column is words, and the last column is number of characters.
Newer versions of "wc" can differentiate between
byte and character count. This difference arises withUnicode which includes multi-byte characters. The desired behaviour is selected with the "-c" or "-m" switch.GNU wc used to be part of the GNUtextutils package, now it's part of GNUcoreutils .Usage
wc -l
print the line count wc -c print the byte count wc -m print the character count wc -L print the length of longest line wc -w print the word count ee also
*
List of Unix programs External links
* [http://www.linuxmanpages.com/man1/wc.1.php] The program's
manpage
* [http://www.bellevuelinux.org/wc.html The wc Command] by The Linux Information Project (LINFO)
Wikimedia Foundation. 2010.