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.
This project implements a custom File Statistics tool called ccwc.
ccwc [OPTION] [FILE]Options:
cCount the number of byteslCount the number of lineswCount the number of wordsmCount the number of characters (including multibyte characters
ccwc [FILE]
- Byte Count: Use the
-coption to count the number of bytes in a file. - Line Count: Use the
-loption to count the number of lines in a file. - Word Count: Use the
-woption to count the number of words in a file. - Character Count: Use the
-moption to count the number of characters (including multibyte characters) in a file.
To get started with the File Statistics Counter utility, follow these steps:
- Clone the repository or download the source code files.
$ git clone https://github.com/Markkimotho/ccwc.git
$ cd ccwc/- Compile the source code using a C compiler.
$ gcc ccwc.c -o ccwcor use make:
$ make- Run the executable file with the desired command-line options and the path to the file you want to analyze.
Example usages:
- To count the number of bytes in a file:
$ ./ccwc -c myfile.txt- To count the number of lines in a file:
$ ./ccwc -l myfile.txt- To count the number of words in a file:
$ ./ccwc -w myfile.txt- To count the number of characters in a file:
$ ./ccwc -m myfile.txt- To count the number of bytes, lines, words and characters in a file:
$ ./ccwc myfile.txtccwc has no external dependencies. It is implemented in plain C and uses standard C libraries.
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
The ccwc utility is based off the Coding Challenges by John Cricket.
The test.txt file was obtained from Project Gutenberg
For any inquiries or questions, you can reach out to me.