wc(1)									wc(1)



NAME

  wc - Counts the lines, words, characters, and bytes in a file

SYNOPSIS

  wc [-clmw] [file ...]

  The wc command counts the lines, words, characters, and bytes in a file, or
  in the standard input if you do not specify any files, and writes the
  results to standard output.  It also keeps a total count for all named
  files.

FLAGS

  -c  Counts bytes only.

  -l  Counts lines only.

  -m  Counts characters only.

  -w  Counts words only.

DESCRIPTION

  A word is defined as a string of characters delimited by white space as
  defined in the X/Open Base Definitions for XCU4.

  The wc command counts lines, words, and bytes by default.  Use the
  appropriate flags to limit wc output.	 Specifying wc without flags is the
  equivalent of specifying wc -lwc.

  The order in which counts appear in the output line matches the order in
  which the flags are entered on the command line.  (If you do not specify
  any flags, the order is lines, words, bytes.)

  When you specify more than one file, wc displays the name of the file along
  with the counts.

EXAMPLES

   1.  To display the number of lines, words, and bytes in the file text,
       enter:
	    wc text


       This results in the following output:
	    27 185 722 text


       The numbers 27, 185, and 722 are the number of lines, words, and
       bytes, respectively, in the file text.

   2.  To display only one or two of the three counts, or to display the
       counts you want in a particular order, include the appropriate flags
       in the order you want.  For example, the following command displays
       only byte and line counts:
	    wc -cl text
	    722 27 text


   3.  To count lines, words, and bytes in more than one file, use wc with
       more than one input file or with a filename pattern.  For example, the
       following command can be issued in a directory containing the files
       text, text1, and text2:
	    wc -l text*
	    27	    text
	    112	    text1
	    5	    text2
	    144	    total


       The numbers 27, 112, and 5 are the numbers of lines in the files text,
       text1, and text2, respectively, and 144 is the total number of lines
       in the three files.

RELATED INFORMATION

  Commands: ls(1).