|
Lines 48-82
Link Here
|
| 48 |
.Sh DESCRIPTION |
48 |
.Sh DESCRIPTION |
| 49 |
The |
49 |
The |
| 50 |
.Nm |
50 |
.Nm |
| 51 |
utility displays the number of lines, words, and bytes contained in each |
51 |
utility displays the number of lines, words, |
|
|
52 |
bytes (or characters), and filename of each |
| 52 |
input |
53 |
input |
| 53 |
.Ar file |
54 |
.Ar file |
| 54 |
(or standard input, by default) to the standard output. |
55 |
to the standard output (on separate lines), except that if |
| 55 |
A line is defined as a string of characters delimited by a <newline> |
56 |
.Ar file |
| 56 |
character, |
57 |
is not specified, |
| 57 |
and a word is defined as a string of characters delimited by white space |
58 |
then standard input is counted and there is no filename output. |
| 58 |
characters. |
59 |
If more than one input file is specified, |
| 59 |
White space characters are the set of characters for which the |
60 |
a line of cumulative counts for all the files is displayed |
| 60 |
.Xr isspace 3 |
61 |
on a separate line after the output for the last file. |
| 61 |
function returns true. |
62 |
.Pp |
| 62 |
If more than one input file is specified, a line of cumulative counts |
63 |
A line is defined as a <newline> character. |
| 63 |
for all the files is displayed on a separate line after the output for |
64 |
Beware that characters following the last <newline> |
| 64 |
the last file. |
65 |
are not included in the line count. |
|
|
66 |
A word is defined as a string of non-whitespace characters |
| 67 |
separated by whitespace characters. |
| 68 |
Whitespace characters are <space>, <horizontal-tab>, <carriage-return>, |
| 69 |
<newline>, <vertical-tab>, and <newpage>. |
| 70 |
A character is normally one byte but might be multiple bytes, |
| 71 |
depending upon the environment. |
| 72 |
(See the ENVIRONMENT section.) |
| 65 |
.Pp |
73 |
.Pp |
| 66 |
The following options are available: |
74 |
The following options are available: |
| 67 |
.Bl -tag -width Ds |
75 |
.Bl -tag -width Ds |
| 68 |
.It Fl c |
76 |
.It Fl c |
| 69 |
The number of bytes in each input file |
77 |
The number of bytes in each input file |
| 70 |
is written to the standard output. |
78 |
is written to the standard output. |
|
|
79 |
This cancels any prior |
| 80 |
.Fl w . |
| 71 |
.It Fl l |
81 |
.It Fl l |
| 72 |
The number of lines in each input file |
82 |
The number of lines in each input file |
| 73 |
is written to the standard output. |
83 |
is written to the standard output. |
| 74 |
.It Fl m |
84 |
.It Fl m |
| 75 |
The number of characters in each input file is written to the standard output. |
85 |
The number of characters in each input file is written to the standard output. |
| 76 |
If the current locale does not support multibyte characters, this |
86 |
If the environment does not support multi-byte characters, this |
| 77 |
is equivalent to the |
87 |
is equivalent to the |
| 78 |
.Fl c |
88 |
.Fl c |
| 79 |
option. |
89 |
option. |
|
|
90 |
This cancels any prior |
| 91 |
.Fl c . |
| 80 |
.It Fl w |
92 |
.It Fl w |
| 81 |
The number of words in each input file |
93 |
The number of words in each input file |
| 82 |
is written to the standard output. |
94 |
is written to the standard output. |
|
Lines 85-99
Link Here
|
| 85 |
When an option is specified, |
97 |
When an option is specified, |
| 86 |
.Nm |
98 |
.Nm |
| 87 |
only reports the information requested by that option. |
99 |
only reports the information requested by that option. |
|
|
100 |
The order of output is always: line, word, byte/character, filename. |
| 88 |
The default action is equivalent to specifying the |
101 |
The default action is equivalent to specifying the |
| 89 |
.Fl c , |
102 |
.Fl c , |
| 90 |
.Fl l |
103 |
.Fl l |
| 91 |
and |
104 |
and |
| 92 |
.Fl w |
105 |
.Fl w |
| 93 |
options. |
106 |
options. |
| 94 |
.Pp |
|
|
| 95 |
If no files are specified, the standard input is used and no |
| 96 |
file name is displayed. |
| 97 |
.Sh ENVIRONMENT |
107 |
.Sh ENVIRONMENT |
| 98 |
The |
108 |
The |
| 99 |
.Ev LANG , |
109 |
.Ev LANG , |
|
Lines 104-121
Link Here
|
| 104 |
.Nm |
114 |
.Nm |
| 105 |
as described in |
115 |
as described in |
| 106 |
.Xr environ 7 . |
116 |
.Xr environ 7 . |
|
|
117 |
For more information, |
| 118 |
see the FreeBSD Handbook's discussion of locale setting. |
| 107 |
.Sh EXAMPLES |
119 |
.Sh EXAMPLES |
| 108 |
Count the number of characters, words and lines in each of the files |
120 |
Count the number of lines, words, and characters in each of the files |
| 109 |
.Pa report1 |
121 |
.Pa report1 |
| 110 |
and |
122 |
and |
| 111 |
.Pa report2 |
123 |
.Pa report2 |
| 112 |
as well as the totals for both: |
124 |
as well as the totals for both: |
| 113 |
.Pp |
125 |
.Pp |
| 114 |
.Dl "wc -mlw report1 report2" |
126 |
.Dl "wc -lwm report1 report2" |
| 115 |
.Sh DIAGNOSTICS |
127 |
.Sh DIAGNOSTICS |
| 116 |
.Ex -std |
128 |
.Ex -std |
| 117 |
.Sh SEE ALSO |
|
|
| 118 |
.Xr isspace 3 |
| 119 |
.Sh COMPATIBILITY |
129 |
.Sh COMPATIBILITY |
| 120 |
Historically, the |
130 |
Historically, the |
| 121 |
.Nm |
131 |
.Nm |