Coding-Challenges

Build Your Own wc Tool

Overview

This project involves creating a custom version of the Unix command-line tool wc. The wc (word count) command is used to count the number of lines, words, and bytes (or characters) in files. This challenge is to build a simplified version of wc that supports some basic options.

The tool will read a file and output counts for:

Features

Usage

Use the following command:

gcc ccwc.c -o wc

Examples

  1. Count Lines in a File
    ./wc -l test.txt 
    

    countline

  2. Count Words in a File
    ./wc -w test.txt 
    

    countword

  3. Count Characters in a File
    ./wc -m test.txt 
    

    countchar

  4. Count Bytes in a File
./wc -c test.txt 

countbytes

  1. Default wc Behavior
    ./wc test.txt 
    

    defult

  2. Display Help Information
    ./wc --help 
    

    help

  3. Read from standard input
    cat test.txt |./wc
    

    stander

Contributing

Feel free to contribute to this project by submitting pull requests or opening issues for improvements and bug fixes.