classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view


Gregory Pietsch
I'm trying to get more of the low-hanging fruit of the GNUish 2.0
project done. This time, it's wc, the word-counting program.


wc - print the number of bytes, words, and lines in files

The wc program counts the number of bytes, whitespace-separated words,
and newlines in a given file, or the standard input if none are given or
when a file named '-' is given.  It prints one line of counts for each
file, and if the file was given as an argument, it prints the filename
following the counts. If more than one filename is given, wc prints a
final line containing the cumulative counts, with the filename 'total'.
The counts are printed in the order: lines, words, characters (if
specified), bytes, the maximum number of characters in a line.

By default, wc prints all three counts. Options can specify that only
certain counts be printed.  Options do not undo others previously given,
so wc --bytes --words prints both the byte counts and word counts.


On a Cygwin installation, it's as easy as

        ./configure;make;make install

Other systems may differ. One may have to modify config.h (provided), then
individually compile wc.c and getopt.c. Then load them into an executable.


-c, --bytes                     Print only the byte counts.

-l, --lines                     Print only the newline counts.

-m, --chars                     Print only the character counts.

-w, --words                     Print only the word counts.

-L, --max-line-length           Print only the maximum line width of a file.
                                 Tabs are considered to be moving the column
                                 to a multiple of 8; nonprintable characters
                                 have a width of zero.

--files0-from=FILE              Get the filenames from a file instead of the
                                 command line.  Within the file, the
names are
                                 delimited with null characters. This option
                                 is useful with the output of the find
                                 with the -print0 option.

--help                          Print a usage message and exit with a
                                 non-zero status.

--version                       Print version information on standard output
                                 then exit.

Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Freedos-devel mailing list
[hidden email]