1.\" Copyright (c) 1991, 1993 2.\" The Regents of the University of California. 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.\" %sccs.include.redist.man% 8.\" 9.\" @(#)wc.1 8.1 (Berkeley) 06/06/93 10.\" 11.Dd 12.Dt WC 1 13.Os 14.Sh NAME 15.Nm wc 16.Nd word, line, and byte count 17.Sh SYNOPSIS 18.Nm wc 19.Op Fl clw 20.Op Ar file ... 21.Sh DESCRIPTION 22The 23.Nm wc 24utility displays the number of lines, words, and bytes contained in each 25input 26.Ar file 27(or standard input, by default) to the standard output. 28A line is defined as a string of chacters delimited by a <newline> character, 29and a word is defined as a string of characters delimited by white space 30characters. 31White space characters are the set of characters for which the 32.Xr isspace 3 33function returns true. 34If more than one input file is specified, a line of cumulative counts 35for all the files is displayed on a separate line after the output for 36the last file. 37.Pp 38The following options are available: 39.Bl -tag -width Ds 40.It Fl c 41The number of bytes in each input file 42is written to the standard output. 43.It Fl l 44The number of lines in each input file 45is written to the standard output. 46.It Fl w 47The number of words in each input file 48is written to the standard output. 49.El 50.Pp 51When an option is specified, 52.Nm wc 53only reports the information requested by that option. 54The default action is equivalent to specifying all of the flags. 55.Pp 56If no files are specified, the standard input is used and no 57file name is displayed. 58.Pp 59The 60.Nm wc 61utility exits 0 on success, and >0 if an error occurs. 62.Sh SEE ALSO 63.Xr isspace 3 64.Sh COMPATIBILITY 65Historically, the 66.Nm wc 67utility was documented to define a word as a ``maximal string of 68characters delimited by <space>, <tab> or <newline> characters''. 69The implementation, however, didn't handle non-printing characters 70correctly so that `` ^D^E '' counted as 6 spaces, while ``foo^D^Ebar'' 71counted as 8 characters. 724BSD systems after 4.3BSD modified the implementation to be consistent 73with the documentation. 74This implementation defines a ``word'' in terms of the 75.Xr isspace 3 76function, as required by 77.St -p1003.2 . 78.Sh STANDARDS 79The 80.Nm wc 81function conforms to 82.St -p1003.2 . 83