A Go CLI Tool for Word, Line, Byte, and Character Counting (like wc)
go-wc is a simple yet powerful command-line tool written in Go that mimics the functionality of the popular Unix utility wc. It counts the number of words, lines, bytes, and characters in a file or standard input.
- Counts words, lines, bytes, and characters
- Supports reading from files or standard input
- Detailed output with options to show individual counts and total sums
Follow the steps below to get started with the DNS server and resolver:
-
Clone the repository using Git:
git clone https://github.com/manthanguptaa/go-wc.git
-
Change to the project directory:
cd go-wc
-
Build the binary:
go build
go-wc [flags] [filename]
Flags:
-c, --c Outputs the numbers of bytes in the file
-h, --help help for go-wc
-l, --l Outputs the numbers of lines in the file
-m, --m Outputs the numbers of characters in the file
-w, --w Outputs the numbers of words in the file
You can find this by typing the following command in the terminal
go-wc -h
By default, go-wc outputs the number of words, lines, bytes, and characters for the file. You can use the -m
and -c
flags to display only characters and bytes, and -w
and -l
to focus on words or lines respectively.
Example: Get the number of words of a file test.txt
./go-wc -w test.txt