Photo by Andrew Tom on Unsplash

Photo by Andrew Tom on Unsplash

Accelerated and targeted search and find with Ripgrep

Rusty Finds

Article from ADMIN 78/2023
By
Ripgrep combines the best features of tools like Grep, Ack, and Silver Searcher when it comes to using search patterns in a terminal window.

If you want to search for specific strings in code or files, you can turn to a number of powerful Unix tools for the command line, such as Ack [1] and Grep [2]. Both use regular expressions for the search patterns. Grep is often used for this type of search, although Ack has a slight edge in terms of functionality. Silver Searcher [3], with a similar orientation, is an Ack fork that aims to boost the search speed. But these old-timers are not the subject of this article. In fact, I'm only mentioning them because they form the basis of Ripgrep.

Ripgrep [4] is a speedy implementation of Grep in the Rust language. The tool searches directories recursively with a pattern of regular expressions (regexes) and outputs all the matches it finds sorted by file. It is part of a collection of modernized Unix tools [5]. Ripgrep additionally adopts some of the features of Ack and Silver Searcher, such as searching a complete directory tree. However, it does not try to be a complete replacement for Grep, because it does not cover 100 percent of Grep's use cases.

One advantage of the Rust programming language is its speed, which is why many Linux tools have been rewritten in Rust in recent years. They include Ripgrep, which is specifically designed to make searching for strings in large files or directories as efficient as possible. The application's syntax is intuitive and easy to learn. The tool offers clear and consistent output that highlights the lines found and presents the results clearly, without requiring actions you would need to achieve comparable results in Grep, including searching for regular expressions, ignoring certain file types, or recursively searching directories. Ripgrep ignores

...
Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus