[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.13

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