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