Skip to content

sunnypatel2048/wc-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Write Your Own wc Tool

My own version of Unix command line tool wc. It prints the word, line character, and byte count of a given file.

This tool was created as a part of Johh Crickett's Coding Challenges. You can find the challenge description here.

Getting Started

Prerequisites

  • Go (Golang) should be installed on your system. If it's not, you can download it from here.

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/sunnypatel2048/wc-Tool.git
  2. Switch to the project directory:

    cd wc-Tool

Setup

  1. Open a terminal and navigate to the project directory.

  2. Build the code using following command:

    go build -o ccwc.exe ./...
  3. Copy the ccwc.exe file to ~/go/bin. Note that this directory thoud be present in PATH variable in Environment variables.

    cp ccwc.exe ~/go/bin/

Usage

ccwc [flag] [filepath]

Supports reading from starndard input if filepath is not specified.

cat test.txt | ccwc [flag]

Flags Supported

  • -c : Prints the number of bytes in the file.
  • -l : Prints the number of lines in the file.
  • -w : Prints the number of words in the file.
  • -m : Prints the number of characters in the file.

Note: If no flag is provided then, number of lines, words, and bytes are printed.

License

This project is licensed under the MIT License. You can view the full license text here.

Releases

No releases published

Packages

No packages published

Languages