Unleashed v1.4
[unleashed.git] / share / man / man1 / wc.1
blob5473f3c7f937c9fd3ec6b545abad0e675ef927f7
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
47 .\"
48 .TH WC 1 "Mar 13, 2008"
49 .SH NAME
50 wc \- display a count of lines, words and characters in a file
51 .SH SYNOPSIS
52 .SS "/usr/bin/wc"
53 .LP
54 .nf
55 \fBwc\fR [\fB-c\fR | \fB-m\fR | \fB-C\fR] [\fB-lw\fR] [\fIfile\fR]...
56 .fi
58 .SS "ksh93"
59 .LP
60 .nf
61 \fBwc\fR [\fB-c\fR | \fB-m\fR | \fB-C\fR] [\fB-lLqw\fR] [\fIfile\fR]...
62 .fi
64 .SH DESCRIPTION
65 .SS "/usr/bin/wc"
66 .sp
67 .LP
68 \fBwc\fR reads one or more input files and, by default, writes the number of
69 NEWLINE characters, words and bytes contained in each input file to the
70 standard output.
71 .sp
72 .LP
73 \fBwc\fR also writes a total count for all named files, if more than one input
74 file is specified.
75 .sp
76 .LP
77 \fBwc\fR considers a \fIword\fR to be a non-zero-length string of characters
78 delimited by white space (for example, \fBSPACE\fR, \fBTAB\fR). See
79 \fBiswspace\fR(3C) or \fBisspace\fR(3C).
80 .SS "ksh93"
81 .sp
82 .LP
83 The \fBwc\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
84 \fB/usr/bin\fR paths. It is invoked when \fBwc\fR is executed without a
85 pathname prefix and the pathname search finds a \fB/bin/wc\fR or
86 \fB/usr/bin/wc\fR executable.
87 .sp
88 .LP
89 \fBwc\fR reads one or more input files and, by default, for each file writes a
90 line containing the number of NEWLINEs, words, and bytes contained in each file
91 followed by the file name to standard output in that order. A word is defined
92 to be a \fBnon-zero\fR length string delimited by \fBisspace\fR(3C) characters.
93 .sp
94 .LP
95 If more than one file is specified, \fBwc\fR writes a total count for all of
96 the named files with total written instead of the file name.
97 .sp
98 .LP
99 By default, \fBwc\fR writes all three counts. Options can specified so that
100 only certain counts are written. The \fB-c\fR, \fB-C\fR, and \fB-m\fR options
101 are mutually exclusive.
104 If no file is specified, or if the file is \fB-\fR, \fBwc\fR reads from
105 standard input and no filename is written to standard output. The start of the
106 file is defined as the current offset.
108 .ne 2
110 \fB\fB-c\fR\fR
114 \fB\fB--bytes | chars\fR\fR
116 .sp .6
117 .RS 4n
118 List the byte counts.
122 .ne 2
124 \fB\fB-l\fR\fR
128 \fB\fB--lines\fR\fR
130 .sp .6
131 .RS 4n
132 List the line counts.
136 .ne 2
138 \fB\fB-L\fR\fR
142 \fB\fB--longest-line | max-line-length\fR\fR
144 .sp .6
145 .RS 4n
146 List the longest line length.
150 .ne 2
152 \fB\fB-m | C\fR\fR
156 \fB\fB--multibyte-chars\fR\fR
158 .sp .6
159 .RS 4n
160 List the character counts.
164 .ne 2
166 \fB\fB-q\fR\fR
170 \fB\fB--quiet\fR\fR
172 .sp .6
173 .RS 4n
174 Suppress invalid multi-byte character warnings.
178 .ne 2
180 \fB\fB-w\fR\fR
184 \fB\fB--words\fR\fR
186 .sp .6
187 .RS 4n
188 List the word counts.
191 .SH OPTIONS
194 The following options are supported:
196 .ne 2
198 \fB\fB-c\fR\fR
200 .RS 6n
201 Counts bytes.
205 .ne 2
207 \fB\fB-C\fR\fR
209 .RS 6n
210 Same as \fB-m\fR.
214 .ne 2
216 \fB\fB-l\fR\fR
218 .RS 6n
219 Counts lines.
223 .ne 2
225 \fB\fB-m\fR\fR
227 .RS 6n
228 Counts characters.
232 .ne 2
234 \fB\fB-w\fR\fR
236 .RS 6n
237 Counts words delimited by white space characters or new line characters.
238 Delimiting characters are Extended Unix Code (\fBEUC\fR) characters from any
239 code set defined by \fBiswspace()\fR.
244 If no option is specified, the default is \fB-lwc\fR (counts lines, words, and
245 bytes.)
246 .SH OPERANDS
249 The following operand is supported:
251 .ne 2
253 \fB\fIfile\fR\fR
255 .RS 8n
256 A path name of an input file. If no \fIfile\fR operands are specified, the
257 standard input is used.
260 .SH ENVIRONMENT VARIABLES
263 See \fBenviron\fR(5) for descriptions of the following environment variables
264 that affect the execution of \fBwc\fR: \fBLANG\fR, \fBLC_ALL\fR,
265 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
266 .SH EXIT STATUS
268 .ne 2
270 \fB\fB0\fR\fR
272 .RS 6n
273 Successful completion.
277 .ne 2
279 \fB\fB>0\fR\fR
281 .RS 6n
282 An error occurred.
285 .SH ATTRIBUTES
288 See \fBattributes\fR(5) for descriptions of the following attributes:
289 .SS "/usr/bin/wc"
294 box;
295 c | c
296 l | l .
297 ATTRIBUTE TYPE  ATTRIBUTE VALUE
299 CSI     Enabled
301 Interface Stability     Committed
303 Standard        See \fBstandards\fR(5).
306 .SS "ksh93"
311 box;
312 c | c
313 l | l .
314 ATTRIBUTE TYPE  ATTRIBUTE VALUE
316 Interface Stability     See below.
321 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
322 The built-in interfaces are Uncommitted.
323 .SH SEE ALSO
326 \fBcksum\fR(1), \fBksh93\fR(1), \fBisspace\fR(3C), \fBiswalpha\fR(3C),
327 \fBiswspace\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5),
328 \fBstandards\fR(5)