A simple command-line application written in Rust that provides text searching and file counting functionalities.
- Grep: Search for specific words or patterns inside text files.
- Case-sensitive and case-insensitive searches.
- Optional line numbering for matching results.
- Counter: Count words in a text file.
- Optional character counting, including whitespace.
- Optional file size reporting in bytes, KiB, MiB, or GiB.
- Download the latest
command-line-program.exefrom the repository's Releases page, or clone the repository and build it yourself. - If building from source, make sure you have Rust and Cargo installed.
- Open a terminal in the project directory and run:
cargo build --release- The executable will be generated inside:
target/release/command-line-program.exe
You can run it through PowerShell or Command Prompt.
Note: Running the executable directly by double-clicking it will close the terminal as soon as the program finishes. Use a terminal to see the output.
All commands are executed through the terminal.
Search for a specific pattern inside a file.
.\command-line-program.exe grep <pattern> <path> [options]| Option | Description |
|---|---|
-c, --case-insensitive |
Ignore uppercase/lowercase differences. |
-i, --line-numbers |
Display line numbers alongside matching lines. |
Examples:
Case-sensitive search:
.\command-line-program.exe grep automation "C:\path\to\test_file.txt"Case-insensitive search with line numbers:
.\command-line-program.exe grep file "C:\path\to\test_file.txt" -c -iCount the words in a text file, with optional character and file size information.
.\command-line-program.exe counter <path> [options]| Option | Description |
|---|---|
-c, --count-characters |
Include the character count (including whitespace). |
-b, --count-bytes |
Include the file size. |
Examples:
Count words:
.\command-line-program.exe counter "C:\path\to\test_file.txt"Count words, characters, and file size:
.\command-line-program.exe counter "C:\path\to\test_file.txt" -c -bThe repository includes a test_file.txt file that you can use to experiment with both commands.
It contains sample text for testing searches, line numbers, word counting, character counting, and file size reporting.
If you clone the repository, you can use its path directly. For example, from the project's root directory:
.\target\release\command-line-program.exe grep file ".\test_file.txt" -c -iThis project is free and open-source software licensed under the MIT License. You are free to use, modify, and distribute this software, including for commercial purposes, provided that the original copyright and license notice are included.