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 myfile
18 52 675 JXTA>cat myfile | wc -w
52
The first example displays the number of lines, words, and characters
in myfile
. The second displays only the number of
lines.
Get JXTA in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.