Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gowc

A simple implementation of the Unix wc (word count) utility written in Go.

Description

gowc counts bytes, words, lines, and finds the longest line length in text files — similar to the standard wc command.

Usage

./main [-c] [-w] [-l] [-L] file [file ...]

Options

Flag Description
-c Print the byte count
-w Print the word count
-l Print the line count
-L Print the longest line length

If no flag is specified, all counts are displayed.

Build

go build -o main main.go

Examples

Default (all counts)

$ ./main test.txt

Filepath: test.txt
-----------------------------
Byte Count : 327854
Word Count : 58164
Line Count : 7144
Longest Line Length : 78

Individual flags

$ ./main -c test.txt

Filepath: test.txt
-----------------------------
Byte Count : 327854
$ ./main -w test.txt

Filepath: test.txt
-----------------------------
Word Count : 58164
$ ./main -l test.txt

Filepath: test.txt
-----------------------------
Line Count : 7144
$ ./main -L test.txt

Filepath: test.txt
-----------------------------
Longest Line Length : 78

Reading from stdin

$ cat test.txt | ./main -w
Word Count : 58164

About

A simple implementation of the Unix wc (word count) utility written in Go.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages