| 1 | .\" Copyright (c) 1991 Regents of the University of California. |
| 2 | .\" All rights reserved. |
| 3 | .\" |
| 4 | .\" This code is derived from software contributed to Berkeley by |
| 5 | .\" the Institute of Electrical and Electronics Engineers, Inc. |
| 6 | .\" |
| 7 | .\" Redistribution and use in source and binary forms, with or without |
| 8 | .\" modification, are permitted provided that the following conditions |
| 9 | .\" are met: |
| 10 | .\" 1. Redistributions of source code must retain the above copyright |
| 11 | .\" notice, this list of conditions and the following disclaimer. |
| 12 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 13 | .\" notice, this list of conditions and the following disclaimer in the |
| 14 | .\" documentation and/or other materials provided with the distribution. |
| 15 | .\" 3. All advertising materials mentioning features or use of this software |
| 16 | .\" must display the following acknowledgement: |
| 17 | .\" This product includes software developed by the University of |
| 18 | .\" California, Berkeley and its contributors. |
| 19 | .\" 4. Neither the name of the University nor the names of its contributors |
| 20 | .\" may be used to endorse or promote products derived from this software |
| 21 | .\" without specific prior written permission. |
| 22 | .\" |
| 23 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 24 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 25 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 26 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 27 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 28 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 29 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 30 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 31 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | .\" SUCH DAMAGE. |
| 34 | .\" |
| 35 | .\" @(#)wc.1 6.4 (Berkeley) 6/27/91 |
| 36 | .\" |
| 37 | .Dd June 27, 1991 |
| 38 | .Dt WC 1 |
| 39 | .Os |
| 40 | .Sh NAME |
| 41 | .Nm wc |
| 42 | .Nd Word, line, and byte count. |
| 43 | .Sh SYNOPSIS |
| 44 | .Nm wc |
| 45 | .Op Fl clw |
| 46 | .Op Ar file ... |
| 47 | .Sh DESCRIPTION |
| 48 | The |
| 49 | .Nm wc |
| 50 | utility reads one or more input text files, and, by |
| 51 | default, writes the number of lines, words, and bytes |
| 52 | contained in each input file to the standard output. |
| 53 | If more than one input file is specified, |
| 54 | a line of cumulative count(s) for all named files is output on a |
| 55 | separate line |
| 56 | following the last file count. |
| 57 | .Nm Wc |
| 58 | considers a word to be a maximal string of |
| 59 | characters delimited by white space. |
| 60 | .Pp |
| 61 | The following options are available: |
| 62 | .Bl -tag -width Ds |
| 63 | .It Fl c |
| 64 | The number of bytes in each input file |
| 65 | is written to the standard output. |
| 66 | .It Fl l |
| 67 | The number of lines in each input file |
| 68 | is written to the standard output. |
| 69 | .It Fl w |
| 70 | The number of words in each input file |
| 71 | is written to the standard output. |
| 72 | .El |
| 73 | .Pp |
| 74 | When an option is specified, |
| 75 | .Nm wc |
| 76 | only |
| 77 | reports the |
| 78 | information requested by that option. The |
| 79 | default action is equivalent to all the |
| 80 | flags |
| 81 | .Fl clw |
| 82 | having been specified. |
| 83 | .Pp |
| 84 | The following operands are available: |
| 85 | .Bl -tag -width Ds |
| 86 | .It Ar file |
| 87 | A pathname of an input file. |
| 88 | .El |
| 89 | .Pp |
| 90 | If no file names |
| 91 | are specified, the standard input is used and |
| 92 | a file name is not output. The resulting output is one |
| 93 | line of the requested count(s) with the cumulative sum |
| 94 | of all files read in via standard input. |
| 95 | .Pp |
| 96 | By default, the standard output contains a line for each |
| 97 | input file of the form: |
| 98 | .Bd -literal -offset indent |
| 99 | lines words bytes file_name |
| 100 | .Ed |
| 101 | .Pp |
| 102 | The counts for lines, words and bytes are integers separated |
| 103 | by spaces. |
| 104 | The ordering of the display of the number of lines, words, |
| 105 | and/or bytes is the order in which the options were specified. |
| 106 | .Pp |
| 107 | The |
| 108 | .Nm wc |
| 109 | utility exits 0 on success, and >0 if an error occurs. |
| 110 | .Sh STANDARDS |
| 111 | The |
| 112 | .Nm wc |
| 113 | function conforms to |
| 114 | .St -p1003.2 . |