Skip to content

justsushant/go-wc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word Count

This excerise deals with a command-line program that implements Unix wc like functionality.

This exercise has been solved in a TDD fashion. Please refer to the execise here.

Features

This program supports the following options:

  • -l show only line count
  • -w show only word count
  • -c show only character count

By default (absence of any options), it shows all three counts.

If more than one file is present in arguments, it shows the counts for all those files, with a total row added at the end.

If no file arguments are present, it reads from STDIN.

Usage

  1. Run the below command to build the binary. It has been saved in the bin directory.
make build
  1. For using the program, arguments and options can be passed as usual. Some examples are as follows:
  • For counting on a single file (for all three counts):
    ./bin/go-wc file.txt
    
  • For counting on multiple files (word and character count):
    ./bin/go-wc file.txt file2.txt -w -c
    
  • For counting on STDIN (only line count):
    ./bin/go-wc -l
    

About

one2n go bootcamp- word count exercise

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages