My own version of Unix command line tool wc
. It prints the word, line character, and byte count of a given file.
This tool was created as a part of Johh Crickett's Coding Challenges. You can find the challenge description here.
- Go (Golang) should be installed on your system. If it's not, you can download it from here.
-
Clone this repository to your local machine:
git clone https://github.com/sunnypatel2048/wc-Tool.git
-
Switch to the project directory:
cd wc-Tool
-
Open a terminal and navigate to the project directory.
-
Build the code using following command:
go build -o ccwc.exe ./...
-
Copy the
ccwc.exe
file to~/go/bin
. Note that this directory thoud be present in PATH variable in Environment variables.cp ccwc.exe ~/go/bin/
ccwc [flag] [filepath]
Supports reading from starndard input if filepath is not specified.
cat test.txt | ccwc [flag]
-c
: Prints the number of bytes in the file.-l
: Prints the number of lines in the file.-w
: Prints the number of words in the file.-m
: Prints the number of characters in the file.
Note: If no flag is provided then, number of lines, words, and bytes are printed.
This project is licensed under the MIT License. You can view the full license text here.