Embedded Commands   «Prev 

Unix wc Command

$ cat letter
Dear Mom,
Final exams are coming up next week.
Please send food and money.

Run the wc command on this file:
$ wc letter
       8      16      90 letter

The wc command tells you that this file has 8 line, 16 words, and 90 characters. You can display just the number of lines using the –l option, the number of words by using the –w option, or the number of characters by using the –c option. Here is the same command using the –l option:
This limits the output to just the number of lines in the letter file.

$ wc –l letter
8 letter