cgrep: Command line tool

[ gpl, program, utils ] [ Propose Tags ]

Cgrep: a context-aware grep for source codes

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS] 6.4, 6.4.1, 6.4.2, 6.4.3,, 6.4.4, 6.4.5, 6.4.6, 6.4.7, 6.4.8, 6.4.9, 6.4.10, 6.4.11, 6.4.12, 6.4.13, 6.4.14, 6.4.15, 6.4.16, 6.4.17, 6.4.18, 6.4.19, 6.4.20, 6.4.21, 6.4.22, 6.5.0, 6.5.1, 6.5.2, 6.5.3, 6.5.4, 6.5.5, 6.5.6, 6.5.7, 6.5.8, 6.5.9, 6.5.10, 6.5.11, 6.5.12, 6.5.13, 6.5.15, 6.6, 6.6.1, 6.6.2, 6.6.3, 6.6.4, 6.6.7, 6.6.8, 6.6.9, 6.6.10, 6.6.11, 6.6.12, 6.6.13, 6.6.14, 6.6.15, 6.6.16, 6.6.17, 6.6.20, 6.6.22, 6.6.23, 6.6.24, 6.6.25, 6.6.30, 6.6.32, 8.0.0, 8.1.0
Dependencies aeson, ansi-terminal, array, async, base (<5.0), bitarray, bitwise, bytestring, bytestring-strict-builder, cmdargs, containers, deepseq, directory, dlist, either, exceptions, extra, filepath, ghc-prim, mmap, monad-loops, mono-traversable, mtl, posix-paths, process, rawfilepath, regex-base, regex-pcre, regex-posix, safe, split, stm, stringsearch, text, transformers, unagi-chan, unicode-show, unix-compat, unordered-containers, utf8-string, vector, yaml [details]
License GPL-2.0-or-later
Author Nicola Bonelli
Maintainer Nicola Bonelli <>
Category Utils
Home page
Uploaded by NicolaBonelli at 2023-07-19T05:50:24Z
Distributions Arch:6.6.32, NixOS:8.1.0
Reverse Dependencies 1 direct, 0 indirect [details]
Executables cgrep
Downloads 46391 total (92 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2023-07-19 [all 2 reports]

Readme for cgrep-8.1.0

[back to package description]

CGrep: a context-aware grep for source codes

Hackage Join the chat at


Cgrep 8.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 --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:
     --name --identifier  Identifiers
     --type --native      Native Types
     --keyword            Keywords
     --number             Literal numbers
     --string             Literal strings
     --op                 Operators

  -S --semantic           "code" pattern: _, _1, _2... (identifiers), $, $1,
                          $2... (optionals), ANY, KEY, STR, LIT, NUM, HEX, OCT,

Output control:
     --max-count=INT      Stop search in files after INT matches
  -t --type-filter=ITEM   Specify file types. ie: Cpp, +Haskell, -Makefile
  -k --kind-filter=ITEM   Specify file kinds. Text, Config, Language, Data,
                          Markup or Script
     --force-type=ITEM    Force the type of file
     --type-list          List the supported file types
  -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
  -L --follow             Follow symlinks

Output format:
     --show-match         Show list of matching tokens
     --color              Use colors to highlight the match 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
     --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 --threads=INT        Number threads to run in parallel

     --verbose=INT        Verbose 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