| Crates.io | grepster |
| lib.rs | grepster |
| version | 0.1.2 |
| created_at | 2025-05-03 15:30:20.308453+00 |
| updated_at | 2025-05-03 15:40:31.750078+00 |
| description | A simple command-line tool for searching text in files |
| homepage | |
| repository | https://github.com/MurtadaNazar/grepster |
| max_upload_size | |
| id | 1658895 |
| size | 44,400 |
A simple command-line utility for searching text in files, inspired by the classic Unix grep tool.
cargo install grepster
git clone https://github.com/MurtadaNazar/grepster.git
cd grepster
cargo install --path .
grepster pattern file.txt
grepster pattern file1.txt file2.txt file3.txt
IGNORE_CASE=1 grepster pattern file.txt
USE_REGEX=1 grepster "^[A-Z].*\d+$" file.txt
SHOW_LINE_NUMBERS=1 grepster pattern file.txt
IGNORE_CASE=1 USE_REGEX=1 SHOW_LINE_NUMBERS=1 grepster pattern file.txt
Search for "Rust" in a file named "programming.txt":
grepster Rust programming.txt
Search for "rust" in multiple files, ignoring case:
IGNORE_CASE=1 grepster rust *.txt
Search for lines starting with a function definition in Rust files:
USE_REGEX=1 grepster "^fn\s+\w+" *.rs
Search for error lines in log files and show line numbers:
SHOW_LINE_NUMBERS=1 grepster error *.log
You can also use grepster as a library in your Rust projects:
use std::env;
use grepster::{Config, run};
fn main() {
let config = Config::build(env::args()).unwrap_or_else(|err| {
eprintln!("Problem parsing arguments: {err}");
std::process::exit(1);
});
if let Err(e) = run(config) {
eprintln!("Application error: {e}");
std::process::exit(1);
}
}
See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.