ripgrep is a fast, powerful cross-platform grep

September 28, 2016 – 08:33 by in Tips Print Share No Comment

ripgrepOnce you’re used to the power of grep, regular Windows text-searching tools can seem a little, well, basic.

Fortunately there some quality alternatives around, and ripgrep is an excellent open-source project with builds available for Windows, Linux and OS X.

As you’d expect, the program arrives as a single executable with no installations or awkward dependencies. Just unzip and place it somewhere on your path.

Basic usage starts very simply.

rg text_to_find

This tells ripgrep to recursively search files in the current directory, ignoring binary or hidden files, displaying the names of any files containing the specified text, with several lines around each hit, and all matches highlighted in colour for easier reading.

ripgrep

ripgrep has a LOT of switches and options to explore

Ripgrep’s real value begins to appear when you use it with regular expressions. The finite automata-based engine isn’t the most comprehensive around, but there’s still a lot of power here.

For example, here’s how you might search for Unicode text strings starting with a Unicode capital letter and followed by a sequence of lower-case Unicode letters.

rg ‘(\p{Lu}\p{Ll}+)\s+(\p{Lu}\p{Ll}+)’ …

A host of command-line switches enable you to specify file masks, include or exclude particular file types, define search types (whole or partial words, case sensitive or insensitive), or set advanced features including support for symbolic links, or setting a custom number of threads for parallel search processing.

There’s a lot to explore, especially 0.2.1, but the developer claims ripgrep is also heavily optimised for speed, carrying out even the most complex searches far faster than most of the competition.

Is that really true? The jury’s still out, but ripgrep is already a very capable tool, and with new releases appearing every few days it looks like there’s plenty more to come. Give it a try.

Ripgrep is an open-source tool for Windows, Linux and Mac.

Related Posts Plugin for WordPress, Blogger...

Comments are closed.