Recursively searching files within a directory/repository using RipGrep.

Divyansh GoyalDivyansh Goyal
2 min read

So, recently amidst working with the julia language ecosystem under the domains of medical imaging and cross-platform binary packaging subecosystem pacakges, namely MedEye3d.jl and BinaryBuilder.jl, I encountered myself navigating back and forth between various files in order to look for a pattern or a piece of text that was a part of "n" number of files within a given directory, so in order to tweak and modify those files to account for troubleshooting practices. The overall process was cumbersome and an alternative way to search for files with a certain text in a given directory, became a quest for search.

RipGrep command line utility introduction

The ChatGPT indulgances deemed worthwhile, after it highlighted a command line utility to "grep" a list of files within a directory based on some passed certain text as an argument.

rg -l "Pice of text"

Apparent Usecases :

Working with BinaryBuilder.jl to build a build_tarballs.jl file for a C++ library, in order to generate and package it's cross-platform binaries in julia, relied heavily on ripgrep, considering that I had to refine multiple build_tarballs.jl for each platform after testing and had to make changes in multiple files based on some certain function name or variable.

Understanding and documenting MedEye3d.jl package as a Google Summer of Code 2024 student. Apart from building binaries and editing files, ripgrep deemed beneficial when trying to understand a package's codebase. Looking for files which handle keyboard inputs , display , visualizations , texture and state management was way easier with ripgrep than manually viewing each file in the editor.

Show some love to the contributors by starring or sponsoring the repository ๐Ÿ’–

RipGrep Github repository

0
Subscribe to my newsletter

Read articles from Divyansh Goyal directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Divyansh Goyal
Divyansh Goyal

Microsoft Learn Student Ambassador Sentient Being | Julia Lang admirer