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 48The 49.Nm wc 50utility reads one or more input text files, and, by 51default, writes the number of lines, words, and bytes 52contained in each input file to the standard output. 53If more than one input file is specified, 54a line of cumulative count(s) for all named files is output on a 55separate line 56following the last file count. 57.Nm Wc 58considers a word to be a maximal string of 59characters delimited by white space. 60.Pp 61The following options are available: 62.Bl -tag -width Ds 63.It Fl c 64The number of bytes in each input file 65is written to the standard output. 66.It Fl l 67The number of lines in each input file 68is written to the standard output. 69.It Fl w 70The number of words in each input file 71is written to the standard output. 72.El 73.Pp 74When an option is specified, 75.Nm wc 76only 77reports the 78information requested by that option. The 79default action is equivalent to all the 80flags 81.Fl clw 82having been specified. 83.Pp 84The following operands are available: 85.Bl -tag -width Ds 86.It Ar file 87A pathname of an input file. 88.El 89.Pp 90If no file names 91are specified, the standard input is used and 92a file name is not output. The resulting output is one 93line of the requested count(s) with the cumulative sum 94of all files read in via standard input. 95.Pp 96By default, the standard output contains a line for each 97input file of the form: 98.Bd -literal -offset indent 99lines words bytes file_name 100.Ed 101.Pp 102The counts for lines, words and bytes are integers separated 103by spaces. 104The ordering of the display of the number of lines, words, 105and/or bytes is the order in which the options were specified. 106.Pp 107The 108.Nm wc 109utility exits 0 on success, and >0 if an error occurs. 110.Sh STANDARDS 111The 112.Nm wc 113function conforms to 114.St -p1003.2 . 115