Name
wc — Counts the number of lines, words, and characters in an object
Synopsis
wc [-c -l -w] [objectName]
Description
wc
counts
the number of newlines, whitespace-separated words, and/or characters
in the given shell object, or in the standard input pipe if no object
is specified. It writes one line of counts to the output pipe. The
counts are written in this order: lines, words, characters. If no
options are given, wc writes all three counts.
If no object is
specified on the command line, wc will read from
stdin. If stdin is the console,
you may type in lines of text, concluding with a line that has a
“.” all by itself.
Options
-
-c Writes the character count
-
-l Writes the line count
-
-w Writes the word count
Examples
JXTA>wc myfile18 52 675 JXTA>cat myfile | wc -w52
The first example displays the number of lines, words, and characters
in myfile. The second displays only the number of
lines.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access