In this video, we build a basic grep clone in C from scratch! 🛠️ We start by demonstrating how the real grep command works, using a sample log file, and then move on to implementing our own version step by step. By the end of the video, you’ll have a functional text-search utility that can read files and find patterns just like grep!
What You’ll Learn:
✅ How grep works and why it’s useful
✅ How to read files line by line in C
✅ How to search for patterns using strstr()
✅ How to add basic regex support using regex.h
✅ How to compile and run your own grep implementation
🔹 Code & Logfile:
https://github.com/Cukowski/grep-in-c...
🔹 Commands Used:
```
grep "ERROR" logfile.txt
./my_grep "ERROR" logfile.txt
```
👉 Subscribe for more system programming tutorials! 🎥✨
Timestamps:
⏳ 0:00 - Introduction – What is grep and why is it useful?
⏳ 1:30 - Demo: Using grep on a sample log file
⏳ 3:45 - Setting up our C project: Including libraries & handling arguments
⏳ 5:20 - Reading files line by line using fgets()
⏳ 7:10 - Implementing basic pattern matching with strstr()
⏳ 9:00 - Running and testing our my_grep program
⏳ 10:50 - Adding support for regex with regex.h (advanced part)
⏳ 14:30 - Error handling & edge cases
⏳ 16:00 - Summary & next steps