#grep #crates #arg #cli #drgrep

bin+lib drgrep

A Rust implementation of the grep software with more support and features for args, workspace scanning and CLI

1 unstable release

new 0.1.0 Apr 17, 2025

#941 in Command line utilities

Custom license

60KB
1K SLoC

drgrep ✨

Build Status License: MIT Crates.io

drgrep is a simple, fast command-line tool written in Rust for searching patterns in text, with minimal external dependencies (beyond Rust itself). It's inspired by grep but uses a simplified and custom regular expression (regex) engine, designed to be lightweight and easy to integrate.

🚀 Features

  • Simple Text Searching: Find lines matching a given pattern in files or from standard input.
  • Custom Regex Engine: Uses an internal implementation for a limited but useful subset of regex features (see Supported Regex Syntax).
  • Fast and Lightweight: Written in Rust for performance and memory safety.
  • Cross-Platform: Pre-compiled binaries are available for Linux, macOS, and Windows via GitHub Releases.
  • Minimal External Dependencies: Designed to minimize dependencies (check your final Cargo.toml).

⚙️ Installation

You can install drgrep in several ways:

Download the binary corresponding to your operating system from the GitHub Releases page.

  1. Go to the releases page.
  2. Find the latest release.
  3. Download the archive for your OS (drgrep-linux, drgrep-macos, drgrep-windows.exe).
  4. (Optional) Rename the file to drgrep (or drgrep.exe) and place it in a directory included in your system's PATH.

2. From Source (with Cargo)

If you have Rust and Cargo installed (rustup), you can compile from source:

# Clone the repository
git clone https://github.com/DoniLite/drgrep.git
cd drgrep

# Compile in release mode
cargo build --release

# The binary will be located at target/release/drgrep
# You can copy it to your PATH:
# sudo cp target/release/drgrep /usr/local/bin/  # Example for Linux/macOS

3. From Crates.io

You can install it directly with Cargo:

cargo install drgrep

📚 Usage

The basic syntax is:

drgrep [ARGS]

Examples:

Basic Regex searching in the .github/

cargo run -- -r Rust -p ./.github

Output: image

Find "error" in the application.log file

drgrep -k error -p application.log

Find 5-letter words in a file (requires supported syntax)

drgrep -r \\w\\w\\w\\w\\w -p document.txt

Using with a pipe

cat data.txt | drgrep -k important data

And other advanced regex features...

🌱 Contributing

Contributions are welcome! Feel free to open an Issue to report a bug or suggest an improvement, or a Pull Request with your changes. Please follow standard open-source contribution practices.

📜 License

This project is distributed under the MIT License. See the LICENSE file for more details.

No runtime deps