*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> wc (1)              
Title
Content
Arch
Section
 

WC(1)

Contents


NAME    [Toc]    [Back]

     wc - word, line, and byte or character count

SYNOPSIS    [Toc]    [Back]

     wc [-c | -m] [-lw] [file ...]

DESCRIPTION    [Toc]    [Back]

     The wc utility reads one or more input text files,  and,  by
default,
     writes  the  number  of lines, words, and bytes contained in
each input file
     to the standard output.  If more  than  one  input  file  is
specified, a line
     of  cumulative  count(s)  for all named files is output on a
separate line
     following the last file count.  wc considers a word to be  a
maximal
     string  of  characters  delimited by whitespace.  Whitespace
characters are
     the set of characters for which the isspace(3) function  returns true.

     The options are as follows:

     -c      The number of bytes in each input file is written to
the standard
             output.

     -l      The number of lines in each input file is written to
the standard
             output.

     -m      The number of characters in each input file is written to the
             standard output.

     -w      The number of words in each input file is written to
the standard
             output.

     When an option is specified, wc only reports the information
requested by
     that option.  The default action is equivalent to the  flags
-clw having
     been  specified.   The -c and -m options are mutually exclusive.

     The following operands are available:

     file    A pathname of an input file.

     If no file names are specified, the standard input  is  used
and a file
     name is not output.  The resulting output is one line of the
requested
     count(s) with the cumulative sum of all files  read  in  via
standard input.

     By default, the standard output contains a line for each input file of
     the form:

           lines    words  bytes   file_name

     If the -m option is specified, the number of  bytes  is  replaced by the
     number  of  characters in the listing above.  The counts for
lines, words,
     and bytes (or characters) are integers separated by  spaces.

     The  wc  utility  exits  0  on success or >0 if an error occurred.

SEE ALSO    [Toc]    [Back]

      
      
     isspace(3)

STANDARDS    [Toc]    [Back]

     Historically, the wc utility was documented to define a word
as a ``maximal
  string  of  characters  delimited  by <space>, <tab> or
<newline> characters''.
  The implementation,  however,  didn't  handle  nonprinting characters
  correctly  so  that  ``  ^D^E  '' counted as 6 spaces,
while
     ``foo^D^Ebar'' counted as 8 characters.  4BSD systems  after
4.3BSD modified
 the implementation to be consistent with the documentation.  This
     implementation defines a ``word'' in terms of the isspace(3)
function, as
     required by IEEE Std 1003.2-1992 (``POSIX.2'').

     The   wc   utility   conforms   to   IEEE   Std  1003.2-1992
(``POSIX.2'').

HISTORY    [Toc]    [Back]

     A wc utility appeared in Version 1 AT&T UNIX.

OpenBSD     3.6                          April      19,      1994
[ Back ]
 Similar pages
Name OS Title
wc FreeBSD word, line, character, and byte count
wc IRIX word, line and byte or character count
cksum Tru64 Displays the checksum and byte count of a file
xlate_pro_disk_header IRIX get translation byte stream block count
sum HP-UX print checksum and block or byte count of file(s)
putw Tru64 Write a byte or a word to a stream
putchar_unlocked Tru64 Write a byte or a word to a stream
putchar Tru64 Write a byte or a word to a stream
getw Tru64 Get a byte or word from an input stream
getc_unlocked Tru64 Get a byte or word from an input stream
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service