Skip to content

victor-devv/mgrep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mgrep - A Simple Grep Clone in Go

Overview

mgrep is a lightweight, concurrent grep-like tool written in Go. It searches for a given substring within files, automatically recursing into subdirectories. Matches are displayed in real-time, including the line number, file path, and full line.

Features

✅ Concurrent file searching using goroutines
✅ Recursive directory traversal
✅ Real-time match output
✅ Synchronization to ensure all files are searched before exit

Installation

git clone https://github.com/victor-devv/mgrep.git  
cd mgrep  
go build -o mgrep  

Usage

./mgrep search_string search_dir

Example:

./mgrep "error" /var/logs
go run ./mgrep --searchterm search_string --searchdir search_dir

Example:

go run ./mgrep --searchterm "error" --searchdir /var/logs

Output format:

/var/logs/app.log[12]: Error detected in system startup
/var/logs/server.log[45]: Connection error at 192.168.1.1

Implementation Details

  • Uses goroutines to efficiently search multiple files in parallel.
  • Uses WaitGroups and Channels to ensure proper synchronization.
  • Recursive traversal of directories to search all files.

License

None


Would you like any additional details or modifications? 🚀

About

mgrep - A Simple Grep Clone in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages