[BACK]Return to wc.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / wc

Annotation of src/usr.bin/wc/wc.1, Revision 1.5

1.5     ! millert     1: .\"    $OpenBSD: wc.1,v 1.4 1998/11/04 22:36:41 aaron Exp $
        !             2: .\"
        !             3: .\" Copyright (c) 1991, 1993
        !             4: .\"    The Regents of the University of California.  All rights reserved.
1.1       deraadt     5: .\"
                      6: .\" This code is derived from software contributed to Berkeley by
                      7: .\" the Institute of Electrical and Electronics Engineers, Inc.
                      8: .\"
                      9: .\" Redistribution and use in source and binary forms, with or without
                     10: .\" modification, are permitted provided that the following conditions
                     11: .\" are met:
                     12: .\" 1. Redistributions of source code must retain the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer.
                     14: .\" 2. Redistributions in binary form must reproduce the above copyright
                     15: .\"    notice, this list of conditions and the following disclaimer in the
                     16: .\"    documentation and/or other materials provided with the distribution.
                     17: .\" 3. All advertising materials mentioning features or use of this software
                     18: .\"    must display the following acknowledgement:
                     19: .\"    This product includes software developed by the University of
                     20: .\"    California, Berkeley and its contributors.
                     21: .\" 4. Neither the name of the University nor the names of its contributors
                     22: .\"    may be used to endorse or promote products derived from this software
                     23: .\"    without specific prior written permission.
                     24: .\"
                     25: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     26: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     27: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     28: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     29: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     30: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     31: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     32: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     33: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     34: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     35: .\" SUCH DAMAGE.
                     36: .\"
1.5     ! millert    37: .\"     from: @(#)wc.1 8.2 (Berkeley) 4/19/94
1.1       deraadt    38: .\"
1.5     ! millert    39: .Dd April 19, 1994
1.1       deraadt    40: .Dt WC 1
                     41: .Os
                     42: .Sh NAME
                     43: .Nm wc
1.4       aaron      44: .Nd word, line, and byte count
1.1       deraadt    45: .Sh SYNOPSIS
                     46: .Nm wc
                     47: .Op Fl c | Fl m
                     48: .Op Fl lw
                     49: .Op Ar file ...
                     50: .Sh DESCRIPTION
                     51: The
                     52: .Nm wc
                     53: utility reads one or more input text files, and, by
                     54: default, writes the number of lines, words, and bytes
                     55: contained in each input file to the standard output.
                     56: If more than one input file is specified,
                     57: a line of cumulative count(s) for all named files is output on a
1.5     ! millert    58: separate line following the last file count.
1.3       aaron      59: .Nm wc
1.5     ! millert    60: considers a word to be a maximal string of characters delimited by white
        !            61: space.  White space characters are the set of characters for which the
        !            62: .Xr isspace 3
        !            63: function returns true.
1.1       deraadt    64: .Pp
                     65: The following options are available:
                     66: .Bl -tag -width Ds
                     67: .It Fl c
                     68: The number of bytes in each input file
                     69: is written to the standard output.
                     70: .It Fl l
                     71: The number of lines in each input file
                     72: is written to the standard output.
                     73: .It Fl m
                     74: The number of characters in each input file
                     75: is written to the standard output.
                     76: .It Fl w
                     77: The number of words in each input file
                     78: is written to the standard output.
                     79: .El
                     80: .Pp
                     81: When an option is specified,
                     82: .Nm wc
1.5     ! millert    83: only reports the information requested by that option.
        !            84: The default action is equivalent to the flags
1.1       deraadt    85: .Fl clw
1.5     ! millert    86: having been specified.  The
        !            87: .Fl c
        !            88: and
        !            89: .Fl m
        !            90: options are mutually exclusive.
1.1       deraadt    91: .Pp
                     92: The following operands are available:
                     93: .Bl -tag -width Ds
                     94: .It Ar file
                     95: A pathname of an input file.
                     96: .El
                     97: .Pp
1.5     ! millert    98: If no file names are specified, the standard input is used
        !            99: and a file name is not output. The resulting output is one
1.1       deraadt   100: line of the requested count(s) with the cumulative sum
                    101: of all files read in via standard input.
                    102: .Pp
                    103: By default, the standard output contains a line for each
                    104: input file of the form:
                    105: .Bd -literal -offset indent
                    106: lines   words  bytes   file_name
                    107: .Ed
                    108: .Pp
                    109: The counts for lines, words and bytes are integers separated
                    110: by spaces.
                    111: .Pp
                    112: The
                    113: .Nm wc
1.3       aaron     114: utility exits 0 on success or >0 if an error occurred.
1.5     ! millert   115: .Sh SEE ALSO
        !           116: .Xr isspace 3
        !           117: .Sh COMPATIBILITY
        !           118: Historically, the
        !           119: .Nm wc
        !           120: utility was documented to define a word as a ``maximal string of
        !           121: characters delimited by <space>, <tab> or <newline> characters''.
        !           122: The implementation, however, didn't handle non-printing characters
        !           123: correctly so that ``  ^D^E  '' counted as 6 spaces, while ``foo^D^Ebar''
        !           124: counted as 8 characters.
        !           125: 4BSD systems after 4.3BSD modified the implementation to be consistent
        !           126: with the documentation.
        !           127: This implementation defines a ``word'' in terms of the
        !           128: .Xr isspace 3
        !           129: function, as required by
        !           130: .St -p1003.2-92 .
1.1       deraadt   131: .Sh STANDARDS
                    132: The
                    133: .Nm wc
                    134: utility conforms to
                    135: .St -p1003.2-92 .