I have called it ccwc
- coding challenge word count.
Part of this Coding challenge: https://codingchallenges.fyi/challenges/challenge-wc
Written in: Python ๐
-
Clone the repo:
$ git clone https://github.com/leekli/wc-recreation.git
-
Ensure at least Python 3.10 is installed.
-
A test file
art_of_war.txt
is supplied to use as an example.
-
Help: Shows the help message, explanation of the application, and options available.
$ ./ccwc.py -h
Note
All commands below can be used either by giving a file name, or piping through standard input (stdin).
-
-c [file_name | stdin]: Displays the number of bytes in the input file / standard input given
- With a file name:
$ ./ccwc.py -c art_of_war.txt
- With standard input:
$ cat art_of_war.txt | ./ccwc.py -c
-
-l [file_name | stdin]: Displays the number of lines in the input file / standard input given
- With a file name:
$ ./ccwc.py -l art_of_war.txt
- With standard input:
$ cat art_of_war.txt | ./ccwc.py -l
-
-w [file_name | stdin]: Displays the number of words in the input file / standard input given
- With a file name:
$ ./ccwc.py -w art_of_war.txt
- With standard input:
$ cat art_of_war.txt | ./ccwc.py -w
-
-m [file_name | stdin]: Displays the number of characters in the input file / standard input given
- With a file name:
$ ./ccwc.py -m art_of_war.txt
- With standard input:
$ cat art_of_war.txt | ./ccwc.py -m
-
[file_name | stdin]: No flags given, only a file name. Displays the number of lines, bytes and characters in the input file given, or piping/using standard input.
- With a file name:
$ ./ccwc.py art_of_war.txt
- Using standard input and no flags or file name given:
$ cat art_of_war.txt | ./ccwc.py