1. Computing & Technology

Discuss in my forum

Juergen Haas

Count Words With The wc Command

By , About.com GuideMarch 19, 2009

Follow me on:

When you are writing a paper for publication there is often a limit or a requirement on the number of words or the number of characters. The wc command is a quick and easy way to get those kinds of stats on a file, or a set of files. It gives you the number of lines, the number of words, and the number of characters.

For example, if you have written a file "report" and type in "wc report" at the command line, it will give you three numbers, the first one being the number of lines in the file "report", the second one the number words, and the last one the number of characters. The nice thing about the wc command is that it is actually easy to remember: wc stands for "word count".

Comments
March 26, 2009 at 3:40 pm
(1) Tommy :

Command line word count???
Sounds antiquated. Any desent wordprocessor does that with a click (or three). And it counts the words, not the “garbage” characters.
But hey, sometimes I jot things down in Leafpad and maybe I need to count the words then.
/Tommy

March 22, 2011 at 4:40 am
(2) Vikas :

It’s useful when used in scripts… or when say, for example, you want to count number of specific processes with running:

$ps -aelf | grep | wc -l

The above command will count and shows the number of lines, i.e. number of processes running with . Useful in scripts.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
Related Searches march 19

©2012 About.com. All rights reserved.

A part of The New York Times Company.