Skip to content

HarshitNTiwari/gowc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gowc

Unix-like wc command-line tool written in Go

This is a Go implementation to mimic the Unix's wc utility that dislays the number of lines, words and bytes contained in an input file - with a few changes.

  • In context of this tool, counting lines means counting the number of new line characters in the input file.
  • A word is defined as a string of characters delimited by characters which are not alphabets or digits.

Usage

  1. Clone the repo and put the input text files in the root folder.

  2. Following is the Synopsis for the tool, that you'll run on your terminal:

gowc [-options] [file ...]
  1. Following are the options that can be used as flags:
-c     Count the number of bytes in the input file
-l     Count the number of new line characters in the input file
-w     Count the number of words in the input file

The default values of these flags is false.

You can also use the -help flag to see these help messages on your terminal.

  1. Here is an example to get the number of words in the input text file:
% go run ./gowc.go -w file.txt
  1. When using multiple flags together, the order of output will be: lines, words, bytes and file name.

  2. If more than one input file is specified, a line for each file is printed showing the results.

About

Unix-like wc command line tool written in Go

Topics

Resources

License

Stars

Watchers

Forks

Languages