Zum Inhalt springen

🦀 Built a Simple grep-like CLI Tool in Rust – Pattern Matching, Highlights, and Match Stats

Hey folks,

I’ve been diving into Rust recently with a strong focus on systems programming and CLI tools. As part of that journey, I built a small utility inspired by grep. It’s a terminal-based tool that searches for a given pattern in one or more files and highlights the matches line by line.

Here’s what it does:

🔍 Features:

  • Accepts a pattern and one or more file paths as arguments
  • Highlights matches within each line (currently using simple string matching)
  • Prints the matched line with its actual line number in the file
  • Displays a match count at the end per file
  • Gracefully handles file read errors and continues processing others
  • Uses eprintln! for error messages and proper exit codes

🧱 Built With:
Rust standard library only — no dependencies (yet).

📂 GitHub Repo:
https://github.com/rajanchoksi79/rgrep

submitted by /u/rcb_7983
[link] [comments]

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert