Skip to content

flan6/gwc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gwc

gwc is a simple implementation of the Unix wc (word count) tool written in Go. This project is a learning exercise inspired by Coding Challenges, aiming to deepen understanding of Go and Unix-like command-line utilities.

Features

  • Count lines, words, and bytes in files or standard input.
  • Mimics basic functionality of the classic wc command.

Usage

./gwc [options] [file...]

Options

  • -l: Count lines.
  • -w: Count words.
  • -c: Count bytes.
  • -m: Count characters.

Examples

Count lines, words, and bytes in a file

./gwc file.txt

Count lines only

./gwc -l file.txt

Count words in multiple files

./gwc -w file1.txt file2.txt

Count characters in multiple files

./gwc -m file1.txt file2.txt

Use standard input

echo "Hello, World!" | ./gwc

Installation

  1. Make sure you have Go installed on your system (version 1.20 or later).
  2. Clone the repository:
    git clone https://github.com/flan6/gwc.git
    cd gwc
  3. Build the project:
    go build -o gwc

Running Tests

Run tests using:

go test ./...

Contributing

This project is a personal learning exercise, but feedback and suggestions are welcome! Feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.


Acknowledgments

  • Inspired by challenges from Coding Challenges.
  • Special thanks to the Go community for their resources and tools.

Disclaimer

This is a learning project and may not handle edge cases or performance optimizations as rigorously as the standard wc tool.

About

Go implementation of the Unix tool wc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages