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.
✅ Concurrent file searching using goroutines
✅ Recursive directory traversal
✅ Real-time match output
✅ Synchronization to ensure all files are searched before exit
git clone https://github.com/victor-devv/mgrep.git
cd mgrep
go build -o mgrep
./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
- 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.
None
Would you like any additional details or modifications? 🚀