Skip to content

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

License

Notifications You must be signed in to change notification settings

DoniLite/drgrep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drgrep ✨

Build Status Tests 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.

GitAds Sponsored

Sponsored by GitAds

🚀 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:

1. Pre-compiled Binaries (Recommended)

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/

drgrep -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 pipe

docker images | drgrep -k postgres -c @ # Be sure to pass this to tell the program to read the standard output

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •  

Languages