glark
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.
As of version 1.9.0, glark is also available for installation via rubygems.org, as:
% gem install glark
Highlighting
In 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 Expressions
glark 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 Expressions
Regular 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 Files
Files that are not text are not searched, by default.
Compatibility with GNU grep
glark supports nearly all of the options in the GNU version of
grep.
Multi-Platform
glark is written in Ruby, and thus can run on a variety of operating systems, including Windows and Unix variants.
Ranges
The --before and --after options restrict searching to the top or end of the file, useful, for example for searching mail headers.
examples
simple matching
% glark 'rb_\w*search' *.c

case insensitive matching
% glark -i stri v*.c

context around match
% glark -2 '\bcontext' o*.c

complex expressions
--or expression
% glark -o sequence initialize ra*.c

--and expression
% glark --and=5 callcc Continuation e*.c

scripting
To search tar file listing for image files:
% for i in `*.tar`; do tar tvf $i | glark --label=$i '\.(png|jpe?g)$'; done
Releases
| version | date | changes |
|---|---|---|
| 1.8.0 | Fixed error message for the usage of a single hyphen as an option. | |
| 1.9.0 | Converted glark to a Ruby Gem. | |
| 1.9.1 | Added the man page to the gem. |