xref: /titanic_44/usr/src/man/man1/wc.1 (revision be468fc6d7266e97f1330ad9a761169925f5f3f1)
te
Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
Copyright 1989 AT&T
Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
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
http://www.opengroup.org/bookstore/.
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.
This notice shall appear on any product containing this material.
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.
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.
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]
WC 1 "Mar 13, 2008"
NAME
wc - display a count of lines, words and characters in a file
SYNOPSIS
"/usr/bin/wc"

wc [-c | -m | -C] [-lw] [file]...
"ksh93"

wc [-c | -m | -C] [-lLqw] [file]...
DESCRIPTION
"/usr/bin/wc"

wc reads one or more input files and, by default, writes the number of NEWLINE characters, words and bytes contained in each input file to the standard output.

wc also writes a total count for all named files, if more than one input file is specified.

wc considers a word to be a non-zero-length string of characters delimited by white space (for example, SPACE, TAB). See iswspace(3C) or isspace(3C).

"ksh93"

The wc built-in in ksh93 is associated with the /bin and /usr/bin paths. It is invoked when wc is executed without a pathname prefix and the pathname search finds a /bin/wc or /usr/bin/wc executable.

wc reads one or more input files and, by default, for each file writes a line containing the number of NEWLINEs, words, and bytes contained in each file followed by the file name to standard output in that order. A word is defined to be a non-zero length string delimited by isspace(3C) characters.

If more than one file is specified, wc writes a total count for all of the named files with total written instead of the file name.

By default, wc writes all three counts. Options can specified so that only certain counts are written. The -c, -C, and -m options are mutually exclusive.

If no file is specified, or if the file is -, wc reads from standard input and no filename is written to standard output. The start of the file is defined as the current offset. -c

--bytes | chars

List the byte counts.

-l

--lines

List the line counts.

-L

--longest-line | max-line-length

List the longest line length.

-m | C

--multibyte-chars

List the character counts.

-q

--quiet

Suppress invalid multi-byte character warnings.

-w

--words

List the word counts.

OPTIONS

The following options are supported: -c

Counts bytes.

-C

Same as -m.

-l

Counts lines.

-m

Counts characters.

-w

Counts words delimited by white space characters or new line characters. Delimiting characters are Extended Unix Code (EUC) characters from any code set defined by iswspace().

If no option is specified, the default is -lwc (counts lines, words, and bytes.)

OPERANDS

The following operand is supported: file

A path name of an input file. If no file operands are specified, the standard input is used.

USAGE

See largefile(5) for the description of the behavior of wc when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).

ENVIRONMENT VARIABLES

See environ(5) for descriptions of the following environment variables that affect the execution of wc: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.

EXIT STATUS
0

Successful completion.

>0

An error occurred.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

"/usr/bin/wc"
ATTRIBUTE TYPE ATTRIBUTE VALUE
CSI Enabled
Interface Stability Committed
Standard See standards(5).
"ksh93"
ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability See below.

The ksh93 built-in binding to /bin and /usr/bin is Volatile. The built-in interfaces are Uncommitted.

SEE ALSO

cksum(1), ksh93(1), isspace(3C), iswalpha(3C), iswspace(3C), setlocale(3C), attributes(5), environ(5), largefile(5), standards(5)