WC(1)
π WC(1) β paragraph, line, word, character, and byte counter π
Okay bestie, welcome to the WC(1) page from the User Contributed Perl Documentation β this is the little Perl-flavored wc situation, and we're gonna go through it together, no cap. β¨
πΈ NAME πΈ
wc - paragraph, line, word, character, and byte counter π
π¦ SYNOPSIS π¦
wc [-a | [-p] [-l] [-w] [-m] [-c] ] [file...]
β¨ 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 β cute bonus energy. π«Ά
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. If no input files are specified, standard input is read. Periodt.
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
And yes: wc uses Perl's use locale pragma. π
π OPTIONS π
noneβ no options towcis equivalent to specifying-l -wand-c.-aβ is equivalent to specifying-p -l -w -mand-c.-pβ tellswcto 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β tellswcto count lines in the input file(s).-wβ tellswcto count words in the input file(s) as determined by perl's"/\w+/"regular expression, which is locale sensitive.-mβ tellswcto count characters in the input file(s). This is implemented with a multi-byte character counting regular expression"m/$encoding/gox". The$encodingdefaults 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β tellswcto count bytes in the input file(s). This is implemented with perl's"length" in perlfuncbuilt 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. Iconic, honestly.
π 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. π
π That's the whole vibe from perl v5.42.2, dated 2026-02-15 β WC(1), out! Bye bestie! π
π¦ where this page comes from
- alpine 3.24: perl-power-tools-doc 1.053-r1 Β· GPL-2.0-or-later AND Artistic-1.0-Perl AND Artistic-2.0 AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms