9070 Remove wanboot from gate
[unleashed.git] / usr / src / man / man1 / wc.1
blob7411cacfa18a6e84f6dd2336686fc7d5079ca587
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
5 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
6 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
7 .\" http://www.opengroup.org/bookstore/.
8 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 .\"  This notice shall appear on any product containing this material.
10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
11 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
12 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 .TH WC 1 "Mar 13, 2008"
14 .SH NAME
15 wc \- display a count of lines, words and characters in a file
16 .SH SYNOPSIS
17 .SS "/usr/bin/wc"
18 .LP
19 .nf
20 \fBwc\fR [\fB-c\fR | \fB-m\fR | \fB-C\fR] [\fB-lw\fR] [\fIfile\fR]...
21 .fi
23 .SS "ksh93"
24 .LP
25 .nf
26 \fBwc\fR [\fB-c\fR | \fB-m\fR | \fB-C\fR] [\fB-lLqw\fR] [\fIfile\fR]...
27 .fi
29 .SH DESCRIPTION
30 .SS "/usr/bin/wc"
31 .sp
32 .LP
33 \fBwc\fR reads one or more input files and, by default, writes the number of
34 NEWLINE characters, words and bytes contained in each input file to the
35 standard output.
36 .sp
37 .LP
38 \fBwc\fR also writes a total count for all named files, if more than one input
39 file is specified.
40 .sp
41 .LP
42 \fBwc\fR considers a \fIword\fR to be a non-zero-length string of characters
43 delimited by white space (for example, \fBSPACE\fR, \fBTAB\fR). See
44 \fBiswspace\fR(3C) or \fBisspace\fR(3C).
45 .SS "ksh93"
46 .sp
47 .LP
48 The \fBwc\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
49 \fB/usr/bin\fR paths. It is invoked when \fBwc\fR is executed without a
50 pathname prefix and the pathname search finds a \fB/bin/wc\fR or
51 \fB/usr/bin/wc\fR executable.
52 .sp
53 .LP
54 \fBwc\fR reads one or more input files and, by default, for each file writes a
55 line containing the number of NEWLINEs, words, and bytes contained in each file
56 followed by the file name to standard output in that order. A word is defined
57 to be a \fBnon-zero\fR length string delimited by \fBisspace\fR(3C) characters.
58 .sp
59 .LP
60 If more than one file is specified, \fBwc\fR writes a total count for all of
61 the named files with total written instead of the file name.
62 .sp
63 .LP
64 By default, \fBwc\fR writes all three counts. Options can specified so that
65 only certain counts are written. The \fB-c\fR, \fB-C\fR, and \fB-m\fR options
66 are mutually exclusive.
67 .sp
68 .LP
69 If no file is specified, or if the file is \fB-\fR, \fBwc\fR reads from
70 standard input and no filename is written to standard output. The start of the
71 file is defined as the current offset.
72 .sp
73 .ne 2
74 .na
75 \fB\fB-c\fR\fR
76 .ad
77 .br
78 .na
79 \fB\fB--bytes | chars\fR\fR
80 .ad
81 .sp .6
82 .RS 4n
83 List the byte counts.
84 .RE
86 .sp
87 .ne 2
88 .na
89 \fB\fB-l\fR\fR
90 .ad
91 .br
92 .na
93 \fB\fB--lines\fR\fR
94 .ad
95 .sp .6
96 .RS 4n
97 List the line counts.
98 .RE
101 .ne 2
103 \fB\fB-L\fR\fR
107 \fB\fB--longest-line | max-line-length\fR\fR
109 .sp .6
110 .RS 4n
111 List the longest line length.
115 .ne 2
117 \fB\fB-m | C\fR\fR
121 \fB\fB--multibyte-chars\fR\fR
123 .sp .6
124 .RS 4n
125 List the character counts.
129 .ne 2
131 \fB\fB-q\fR\fR
135 \fB\fB--quiet\fR\fR
137 .sp .6
138 .RS 4n
139 Suppress invalid multi-byte character warnings.
143 .ne 2
145 \fB\fB-w\fR\fR
149 \fB\fB--words\fR\fR
151 .sp .6
152 .RS 4n
153 List the word counts.
156 .SH OPTIONS
159 The following options are supported:
161 .ne 2
163 \fB\fB-c\fR\fR
165 .RS 6n
166 Counts bytes.
170 .ne 2
172 \fB\fB-C\fR\fR
174 .RS 6n
175 Same as \fB-m\fR.
179 .ne 2
181 \fB\fB-l\fR\fR
183 .RS 6n
184 Counts lines.
188 .ne 2
190 \fB\fB-m\fR\fR
192 .RS 6n
193 Counts characters.
197 .ne 2
199 \fB\fB-w\fR\fR
201 .RS 6n
202 Counts words delimited by white space characters or new line characters.
203 Delimiting characters are Extended Unix Code (\fBEUC\fR) characters from any
204 code set defined by \fBiswspace()\fR.
209 If no option is specified, the default is \fB-lwc\fR (counts lines, words, and
210 bytes.)
211 .SH OPERANDS
214 The following operand is supported:
216 .ne 2
218 \fB\fIfile\fR\fR
220 .RS 8n
221 A path name of an input file. If no \fIfile\fR operands are specified, the
222 standard input is used.
225 .SH USAGE
228 See \fBlargefile\fR(5) for the description of the behavior of \fBwc\fR when
229 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
230 .SH ENVIRONMENT VARIABLES
233 See \fBenviron\fR(5) for descriptions of the following environment variables
234 that affect the execution of \fBwc\fR: \fBLANG\fR, \fBLC_ALL\fR,
235 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
236 .SH EXIT STATUS
238 .ne 2
240 \fB\fB0\fR\fR
242 .RS 6n
243 Successful completion.
247 .ne 2
249 \fB\fB>0\fR\fR
251 .RS 6n
252 An error occurred.
255 .SH ATTRIBUTES
258 See \fBattributes\fR(5) for descriptions of the following attributes:
259 .SS "/usr/bin/wc"
264 box;
265 c | c
266 l | l .
267 ATTRIBUTE TYPE  ATTRIBUTE VALUE
269 CSI     Enabled
271 Interface Stability     Committed
273 Standard        See \fBstandards\fR(5).
276 .SS "ksh93"
281 box;
282 c | c
283 l | l .
284 ATTRIBUTE TYPE  ATTRIBUTE VALUE
286 Interface Stability     See below.
291 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
292 The built-in interfaces are Uncommitted.
293 .SH SEE ALSO
296 \fBcksum\fR(1), \fBksh93\fR(1), \fBisspace\fR(3C), \fBiswalpha\fR(3C),
297 \fBiswspace\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5),
298 \fBlargefile\fR(5), \fBstandards\fR(5)