WC - John Crickett's Coding Challenge #1
This is an implementation of the Unic command line tool wc. This is a solution to the Week 1 problem in John Crickett's Coding Challenges.
-
Clone Repository:
git clone https://github.com/AdityaCH1997/ccwc.git cd ccwc -
Check If Script is executable:
ls -al
If script does not have
xin the permissions add permission using following commandchmod +x ccwc.sh
-
Source Script:
source ccwc.sh -
Test Script:
- Count the number of bytes in a file
ccwc -c test.txt
- Count the number of lines in a file
ccwc -l test.txt
- Count the number of characters in a file
ccwc -m test.txt
- Count the number of words in a file
ccwc -w test.txt
- Default count of lines, words and bytes in a file
ccwc test.txt
- Reading file from standard input when no filename is provided
cat test.txt | ccwc -l -
Feel free to test further and add new functionalities