aben-wc is a lightweight command-line utility written in Go, designed to replicate the core functionality of the standard Unix wc (word count) tool. It provides a simple and efficient way to analyze files directly from your terminal.
- Byte Count: Calculate the size of a file in bytes using the
-cflag. - Line Count: Count the number of lines in a file using the
-lflag. - Word Count: Count the number of words in a file using the
-wflag. - Character Count: Count the number of characters in a file using the
-mflag. - Default Mode: Display line, word, and byte counts when no flag is provided.
- Standard Input: Support reading from standard input (stdin) via pipes.
For a detailed overview of the project's design, components, and data flow, please refer to the Architecture Documentation.
- Go (version 1.18 or higher recommended)
-
Clone the repository:
git clone https://github.com/abeni-al7/aben-wc.git cd aben-wc -
Build the application:
go build -o abenwc main.go
Run the built executable with the desired flag and the target file path, or pipe content to it.
To analyze content piped from another command:
cat test.txt | ./abenwc -lExample:
cat test.txt | ./abenwc -l
# Output: 7145To display line, word, and byte counts:
./abenwc <filename>Example:
./abenwc test.txt
# Output: 7145 58164 342190 test.txtTo display the number of bytes in a file:
./abenwc -c <filename>Example:
./abenwc -c test.txt
# Output: 342190 test.txtTo display the number of lines in a file:
./abenwc -l <filename>Example:
./abenwc -l test.txt
# Output: 7145 test.txtTo display the number of words in a file:
./abenwc -w <filename>Example:
./abenwc -w test.txt
# Output: 58164 test.txtTo display the number of characters in a file:
./abenwc -m <filename>Example:
./abenwc -m test.txt
# Output: 339292 test.txtTo run the unit tests for the project:
go test ./tests/...