Giter Club home page Giter Club logo

wc-recreation's Introduction

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
    

wc-recreation's People

Watchers

Lee ๆŽ avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.