1wc(1)                            User Commands                           wc(1)
2
3
4

NAME

6       wc - display a count of lines, words and characters in a file
7

SYNOPSIS

9   /usr/bin/wc
10       wc [-c | -m | -C] [-lw] [file]...
11
12
13   ksh93
14       wc [-c | -m | -C] [-lLqw] [file]...
15
16

DESCRIPTION

18   /usr/bin/wc
19       wc  reads one or more input files and, by default, writes the number of
20       NEWLINE characters, words and bytes contained in each input file to the
21       standard output.
22
23
24       wc  also  writes  a  total  count for all named files, if more than one
25       input file is specified.
26
27
28       wc considers a word to be a non-zero-length string of characters delim‐
29       ited by white space (for example, SPACE, TAB). See iswspace(3C) or iss‐
30       pace(3C).
31
32   ksh93
33       The wc built-in in ksh93 is  associated  with  the  /bin  and  /usr/bin
34       paths.  It is invoked when wc is executed without a pathname prefix and
35       the pathname search finds a /bin/wc or /usr/bin/wc executable.
36
37
38       wc reads one or more input files and, by default, for each file  writes
39       a line containing the number of NEWLINEs, words, and bytes contained in
40       each file followed by the file name to standard output in that order. A
41       word is defined to be a non-zero length string delimited by isspace(3C)
42       characters.
43
44
45       If more than one file is specified, wc writes a total count for all  of
46       the named files with total written instead of the file name.
47
48
49       By  default,  wc writes all three counts. Options can specified so that
50       only certain counts are written. The -c, -C, and -m options  are  mutu‐
51       ally exclusive.
52
53
54       If  no  file  is specified, or if the file is -, wc reads from standard
55       input and no filename is written to standard output. The start  of  the
56       file is defined as the current offset.
57
58       -c
59       --bytes | chars
60
61           List the byte counts.
62
63
64       -l
65       --lines
66
67           List the line counts.
68
69
70       -L
71       --longest-line | max-line-length
72
73           List the longest line length.
74
75
76       -m | C
77       --multibyte-chars
78
79           List the character counts.
80
81
82       -q
83       --quiet
84
85           Suppress invalid multi-byte character warnings.
86
87
88       -w
89       --words
90
91           List the word counts.
92
93

OPTIONS

95       The following options are supported:
96
97       -c    Counts bytes.
98
99
100       -C    Same as -m.
101
102
103       -l    Counts lines.
104
105
106       -m    Counts characters.
107
108
109       -w    Counts  words  delimited  by  white  space characters or new line
110             characters. Delimiting characters are Extended  Unix  Code  (EUC)
111             characters from any code set defined by iswspace().
112
113
114
115       If  no  option  is specified, the default is -lwc (counts lines, words,
116       and bytes.)
117

OPERANDS

119       The following operand is supported:
120
121       file    A path name of an input file. If no file  operands  are  speci‐
122               fied, the standard input is used.
123
124

USAGE

126       See largefile(5) for the description of the behavior of wc when encoun‐
127       tering files greater than or equal to 2 Gbyte ( 2^31 bytes).
128

ENVIRONMENT VARIABLES

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

EXIT STATUS

135       0     Successful completion.
136
137
138       >0    An error occurred.
139
140

ATTRIBUTES

142       See attributes(5) for descriptions of the following attributes:
143
144   /usr/bin/wc
145       ┌─────────────────────────────┬─────────────────────────────┐
146       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
147       ├─────────────────────────────┼─────────────────────────────┤
148       │Availability                 │SUNWcsu                      │
149       ├─────────────────────────────┼─────────────────────────────┤
150       │CSI                          │Enabled                      │
151       ├─────────────────────────────┼─────────────────────────────┤
152       │Interface Stability          │Committed                    │
153       ├─────────────────────────────┼─────────────────────────────┤
154       │Standard                     │See standards(5).            │
155       └─────────────────────────────┴─────────────────────────────┘
156
157   ksh93
158       ┌─────────────────────────────┬─────────────────────────────┐
159       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
160       ├─────────────────────────────┼─────────────────────────────┤
161       │Availability                 │SUNWcsu                      │
162       ├─────────────────────────────┼─────────────────────────────┤
163       │Interface Stability          │See below.                   │
164       └─────────────────────────────┴─────────────────────────────┘
165
166
167       The ksh93 built-in binding to /bin and /usr/bin is Volatile. The built-
168       in interfaces are Uncommitted.
169

SEE ALSO

171       cksum(1),  ksh93(1),  isspace(3C),  iswalpha(3C),  iswspace(3C), setlo‐
172       cale(3C), attributes(5), environ(5), largefile(5), standards(5)
173
174
175
176SunOS 5.11                        13 Mar 2008                            wc(1)
Impressum