Cgrep

Cgrep: a context-aware grep for source codes

View the Project on GitHub awgn/cgrep

Welcome to the CGrep Homepage.

CGrep is a context-aware grep tool designed specifically for searching in large code repositories. It supports advanced searches across 50+ programming languages that go beyond simple pattern matching, enabling context-aware filtering and semantic searches using wildcards and combinators.

Features

What’s new in v9.0.0

Installation

cabal install cgrep

or

stack install cgrep

Quick Examples

Search for a pattern in source code only (excluding comments and strings):

cgrep -c "malloc" *.c

Search using semantic wildcards to find variable assignments:

cgrep -S "_ = NUM" *.c

Search in production code only, excluding all test files:

cgrep -T False "function" -r src/

Search recursively in C++ files:

cgrep --type=Cpp -r "vector" src/

Documentation

For complete documentation, examples, and the full list of supported features, visit the GitHub repository.

Author

Nicola Bonelli