Simplified clone of the wc Unix command line tool.
- man wc
- info '(coreutils) wc invocation'
make build # compile project (create executable ./ccwc)
make test # run unit tests
make report # generate unit tests coverage reportYou can benchmark the script by using the benchmark target, which will compare the runtimes
of native wc and this utility:
make benchmarkIt relies on hyperfine and python scripts. As a pre-requisites, you will need below python dependencies installed:
pip install numpy matplotlib scipy
Available options:
$ ./ccwc --help
# sample output
Usage: ccwc [OPTION...] [FILENAME]
A simplified clone of wc.
-c, --bytes print the byte counts
-l, --lines print the newline counts
-m, --chars print the character counts
-w, --words print the word counts
-?, --help Give this help list
--usage Give a short usage message
-V, --version Print program version
Report bugs to <maxou.info@gmail.com>.Count number of bytes in given file:
$ ./ccwc -c data/test.txt
# sample output
342190 data/test.txtCount number of lines in given file:
$ ./ccwc -l data/test.txt
# sample output
7145 data/test.txtCount number of chars in given file:
$ ./ccwc -m data/test.txt
# sample output
339292 data/test.txtCount number of words in given file:
$ ./ccwc -w data/test.txt
# sample output
58164 data/test.txtYou can combine multiple count flags:
$ ./ccwc -wlm data/test.txt
# sample output
7145 58164 339292 data/test.txtWhen multiple count flags are provided, the print order will always be lines, words, chars and then bytes count.
If no count flags are given, default to lines, words and bytes count:
$ ./ccwc data/test.txt
# sample output
7145 58164 342190 data/test.txtIf no file is given, default to stdin:
$ cat data/test.txt | ./ccwc
# sample output
7145 58164 342190