The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

wc -- paragraph, line, word, character, and byte counter.

SYNOPSIS

wc [-a | [-p] [-l] [-w] [-m] [-c] ] file [file1 [file2...]]

DESCRIPTION

wc reads one or more input text files and, by default, writes the number of lines, words, and bytes contained in each input file to the standard output. An optional count of paragraphs or characters is also possible in this implementation. If more than one text file is specified, a line of total count(s) for all named files is output on a separate line following the last file count.

By default, the standard output contains a line for each input file of the form:

     lines     words     bytes file_name

With all options specified the output line for each input file is of the form:

     paras     lines     words     chars     bytes file_name

wc uses Perl's use locale pragma.

OPTIONS

none

No options to wc is equivalent to specifying -l -w and -c.

-a

Is equivalent to specifying -p -l -w -m and -c.

-p

Tells wc to count paragraphs in the input file(s). The algorithm employed counts lumped groups of lines that do not contain only zero or more space characters (/^\s*$/). This regular expression is sensitive to locale settings.

-l

Tells wc to count lines in the input file(s).

-w

Tells wc to count words in the input file(s) as determined by perl's /\w+/ regular expression which is locale sensitive.

-m

Tells wc to count characters in the input file(s). This is implemented with a multi-byte character counting regular expression m/$encoding/gox. The $encoding defaults to one sensitive to well formed UTF-8 encodings (one to six byte characters) though this may be altered to other encodings by alteration of the program code. Note that some 8 bit single byte characters will be missed by the UTF-8 character counter since such characters fall outside the UTF-8 encoding.

-c

Tells wc to count bytes in the input file(s). This is implemented with perl's "length" in perlfunc built in function.

ENVIRONMENT

The working of wc may be influenced by your locale since it uses the locale pragma and this could have an effect on -w (word) and -p (paragraph) counts. wc may also be influenced by PERLLIB or PERL5LIB since it uses File::Basename, locale, and strict internally.

SEE ALSO

perllocale.

BUGS

wc has no known bugs.

STANDARDS

The -a and -p options are peculiarities of this Perl implementation.

AUTHOR

Peter Prymmer pvhp@best.com.

COPYRIGHT and LICENSE

This program is copyright (c) by Peter Prymmer 1999.

This program is free and open software. You may use, copy, modify, distribute and sell this program (and any modified variants) in any way you wish, provided you do not restrict others to do the same.