Coding challenge #1
This is my implementation of the UNIX command line tool wc in python. This gives the count of words, bytes, lines characters as output for a given input file or input
- Clone this repository
- run
pip install -r requirements.txt - To run this functionality on the command line run the following commands to form a symlink for the python file
sudo ln -s /path/to/wc-tool.py /usr/local/bin/ccwc
readlink -f /usr/local/bin/ccwc (you should see the full path to the wc-tool.py)
-
Now you can use the command from any directory:
ccwc input.txt -wccwc input.txt -lccwc input.txt -bccwc input.txt -c
If you don't specify any arguments, all the counts will be in the output.
You can replace input.txt with the path to your desired text file.
for example:
echo "This is a test" | ccwc -w
If no filename is specified, you can provide input directly, and the tool will read from standard input.
- Enjoy the Results!
The tool will display the requested count along with the input file name (if applicable).
Requirements:
- Python 3.x
- Click library