link to content
Essentials at NC State Home
skip header navigation and go to content Help | ResNet | Computing@NC State | For OIT Staff | Publications | Search NC State | Feedback | Site Map
your unity account
antivirus & security
email & messaging
connections & labs
your computer
software@nc state
files
web pages
education & training
publications
other resources
troubleshooting
ITD Sections

Counting lines, words and characters

The wc command displays the number of lines, words and characters in a file.

The syntax for the wc is

wc filename

For example, the command wc my_speech might give you something like the following:

unity% wc my_speech
    1018    6407   43366 my_speech
unity%

This means that "my_speech" has 1018 lines, 6407 words and 43366 characters in it.

If you can't remember which value means what, just remember that you can use options (l, w, c) to get only the value you desire.

     l    to count lines.

     w    to count words.

     c    to count characters.

For instance, the command

wc -w my_speech

will return only the number of words in the speech, in this case 6407.

 

Last modified July 20, 2004 by cawalker

jump back to content/page ends, begin footer
jump to content
jump to content Go to page top Page Top | Site Map | OIT | Policy Disclaimer | Site Survey