|
A replacement for (or supplement to) the grep family, glark offers: Perl compatible regular expressions, highlighting of matches, context around matches, complex expressions (``and'' and ``or''), and automatic exclusion of non-text files. HighlightingIn default mode, glark highlights matches and file names, for example: % glark '=\s*rb_v?sprintf' *.c On a subset of the Ruby source code, this produces: ![]() Colors can be customized by settings in a configuration file (~/.glarkrc), an environment variable (GLARKOPTS), or the command line. Perl Compatible Regular Expressionsglark provides the ability to use Perl compatible regular expressions (PCRE), which should be familiar to users of Perl, PHP, and Ruby. For example, this searches for a word boundary, followed by "val", not followed by "ue": % glark '\bval(?!ue)' *.c PCRE documentation can be found here. Compound ExpressionsRegular expressions can be combined into complex expressions that span multiple lines, such as the following, which searches for "printStackTrace" within 2 lines of "catch": % glark --and=2 printStackTrace catch *.java To search for either "catch" or "throw" on the same line: % glark --or catch throw *.java This searches for "cout" or "printf", within 5 lines of either "double" or "float": % glark --and=5 --or cout print --or double float *.c Detection of Text FilesFiles that are not text are not searched, by default. Compatibility with GNU
|
|
