Skip to content

I build my own version of the Unix command line tool: wc

Notifications You must be signed in to change notification settings

leekli/wc-recreation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ccwc - [coding challenge] word count

🧐 About Repo

In this repo, I build my own version of the Unix command line tool: wc

I have called it ccwc - coding challenge word count.

Part of this Coding challenge: https://codingchallenges.fyi/challenges/challenge-wc

Written in: Python 🐍

👨‍🏫 Set-up

  1. Clone the repo:

    $ git clone https://github.com/leekli/wc-recreation.git
    
  2. Ensure at least Python 3.10 is installed.

  3. A test file art_of_war.txt is supplied to use as an example.

💻 Commands & Options available

  • Help: Shows the help message, explanation of the application, and options available.

    $ ./ccwc.py -h
    

Note

All commands below can be used either by giving a file name, or piping through standard input (stdin).

  • -c [file_name | stdin]: Displays the number of bytes in the input file / standard input given

    • With a file name:
    $ ./ccwc.py -c art_of_war.txt
    
    • With standard input:
    $ cat art_of_war.txt | ./ccwc.py -c
    



  • -l [file_name | stdin]: Displays the number of lines in the input file / standard input given

    • With a file name:
    $ ./ccwc.py -l art_of_war.txt
    
    • With standard input:
    $ cat art_of_war.txt | ./ccwc.py -l
    



  • -w [file_name | stdin]: Displays the number of words in the input file / standard input given

    • With a file name:
    $ ./ccwc.py -w art_of_war.txt
    
    • With standard input:
    $ cat art_of_war.txt | ./ccwc.py -w
    



  • -m [file_name | stdin]: Displays the number of characters in the input file / standard input given

    • With a file name:
    $ ./ccwc.py -m art_of_war.txt
    
    • With standard input:
    $ cat art_of_war.txt | ./ccwc.py -m
    



  • [file_name | stdin]: No flags given, only a file name. Displays the number of lines, bytes and characters in the input file given, or piping/using standard input.

    • With a file name:
    $ ./ccwc.py art_of_war.txt
    
    • Using standard input and no flags or file name given:
    $ cat art_of_war.txt | ./ccwc.py
    

About

I build my own version of the Unix command line tool: wc

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages