A Golang implementation of the Unix wc utility. Counts lines, words, bytes, and characters in one or more files, or from stdin.
gwc [OPTIONS] [FILES]...| Flag | Description |
|---|---|
-l, --lines |
Print the line count |
-w, --words |
Print the word count |
-c, --bytes |
Print the byte count |
-m, --chars |
Print the character count |
If no flags are provided, -l, -w, and -c are enabled by default — matching the behavior of wc.
From files:
gwc file.txt
gwc -l -w file1.txt file2.txtFrom stdin:
echo "hello world" | gwc
cat file.txt | gwc -lIf neither files nor stdin input are provided, the program will exit with an error.
$ echo "hello world" | gwc
stdin: Byte count: 12
stdin: Line count: 1
stdin: Word count: 2Requires Golang.
make buildThe compiled binary will be at ./bin/rwc.
If you see a problem or improvement that can be made, please open up an issue to discuss it.
Copyright© 2026 Ryan Hendrickson. Released under the MIT License. See LICENSE for details.