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