cgrep is a tool to search for files with specific words or search for certain words within a file
|
|
||
|---|---|---|
| src | init commit | |
| .gitignore | add .gitignore | |
| Makefile | fixed Makefile | |
| README.md | add README.md | |
cgrep
Fast grep clone written in C++ with multithreading support.
Build
make
sudo make install
Usage
cgrep [OPTIONS] PATTERN [FILE...]
Options
Option Description -i, --ignore-case Case insensitive search -r, --recursive Search directories recursively -n, --no-line-numbers Hide line numbers -c, --count Show match count only -v, --invert-match Show non-matching lines -e, --regex Pattern is regex -t, --threads N Use N threads --no-color Disable colored output -h, --help Show help
Examples
# Basic search
cgrep "error" app.log
# Case insensitive
cgrep -i "warning" *.log
# Recursive search
cgrep -r "TODO" ./src
# Count matches
cgrep -c "function" *.js
# Regex pattern
cgrep -e "[0-9]{3}-[0-9]{4}" data.txt
# Pipe from stdin
cat file.txt | cgrep "pattern"
# Multithreaded search
cgrep -t 4 "import" *.py
# Invert match
cgrep -v "debug" server.log
Requirements
· C++17 compiler · pthread
License
GPL v1