ccwc - Custom File Statistics Tool

A command-line utility providing file statistics similar to Unix wc

Overview

ccwc is a command-line utility that provides various statistics about a given file, similar to the Unix wc tool. It counts the number of bytes, lines, words, and characters (including multibyte characters) in the specified file.

Features

  • Byte Count: Use the -c option to count the number of bytes in a file
  • Line Count: Use the -l option to count the number of lines in a file
  • Word Count: Use the -w option to count the number of words in a file
  • Character Count: Use the -m option to count the number of characters (including multibyte characters) in a file
  • Default Behavior: Run without options to get all statistics

Usage

ccwc [OPTION] [FILE]

Options

Option Description
-c Count the number of bytes
-l Count the number of lines
-w Count the number of words
-m Count the number of characters (including multibyte)

Examples

# Count bytes
./ccwc -c myfile.txt

# Count lines
./ccwc -l myfile.txt

# Count words
./ccwc -w myfile.txt

# Count characters
./ccwc -m myfile.txt

# Get all statistics
./ccwc myfile.txt

Getting Started

Installation

Clone the repository:

git clone https://github.com/Markkimotho/ccwc.git
cd ccwc/

Compile using gcc:

gcc ccwc.c -o ccwc

Or using make:

make

Technical Details

  • Language: C
  • Dependencies: None (uses standard C libraries)
  • Build System: Makefile included

Acknowledgments

The ccwc utility is based on the Coding Challenges by John Cricket. Test data obtained from Project Gutenberg.

Repository

View on GitHub