Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
September 12, 2022 21:02
May 22, 2022 19:40
May 14, 2022 14:10
June 19, 2014 10:38
July 25, 2022 19:18
June 19, 2014 10:38
September 12, 2022 21:02
September 12, 2022 20:50

CGrep: a context-aware grep for source codes

Hackage Join the chat at


Cgrep 7.0.0. Usage: cgrep [OPTION] [PATTERN] files...

cgrep [OPTIONS] [ITEM]

  -f --file=FILE             Read PATTERNs from file (one per line)
  -w --word                  Force word matching
  -p --prefix                Force prefix matching
  -s --suffix                Force suffix matching
  -e --edit                  Use edit distance
  -G --regex                 Use regex matching (posix)
  -P --regex-pcre            Use regex matching (pcre)
  -i --ignore-case           Ignore case distinctions

Context filters:
  -c --code                  Enable search in source code
  -m --comment               Enable search in comments
  -l --literal               Enable search in string literals

Token filters:
     --identifier            Identifiers
     --keyword               Keywords
     --number                Literal numbers
     --string                Literal strings
     --oper                  Operators

  -S --semantic              "code" pattern: _, _1, _2... (identifiers), $,
                             $1, $2... (optionals), ANY, KEY, STR, LIT, NUM,
                             HEX, OCT, OR. -> e.g. "_1(_1 && \$)" search for
                             move constructors, "struct OR class _ { OR : OR <"
                             search for a class declaration

Output control:
     --max-count=INT         Stop search in files after INT matches
     --language-filter=ITEM  Specify languages. ie: Cpp, +Haskell, -Makefile
     --language-force=ITEM   Force the language
     --language-map          Lists the language mappings
     --magic-filter=ITEM     Use unix magic as file-filter
  -v --invert-match          Select non-matching lines
     --multiline=INT         Enable multi-line matching
  -r --recursive             Enable recursive search (don't follow symlinks)
  -T --skip-test             Skip files that have 'test' in the name
     --prune-dir=ITEM        Do not descend into dir
  -R --deference-recursive   Recursive, follow symlinks

Output format:
     --show-match            Show list of matching tokens
     --color                 Use colors to highlight the matching strings
     --no-color              Do not use colors (override config file)
  -h --no-filename           Suppress the file name prefix on output
     --no-numbers            Suppress both line and column numbers on output
     --no-column             Suppress the column number on output
     --count                 Print only a count of matching lines per file
     --filename-only         Print only the name of files containing matches
     --json                  Format output as json object
     --xml                   Format output as xml document
     --vim                   Run vim editor passing the files that match
     --editor                Run the editor specified by EDITOR var., passing
                             the files that match
     --fileline              When edit option is specified, pass the list of
                             matching files in file:line format (e.g. vim
                             'file-line' plugin)

  -j --jobs=INT              Number of jobs to run in parallel
  -a --asynch                Process chunks asynchronously

     --verbosity=INT         Verbosity level: 1, 2 or 3
     --no-shallow            Disable shallow-search
     --palette               Show color palette
  -? --help                  Display help message
  -V --version               Print version information
     --numeric-version       Print just the version number