Quickly Search for Something in Your Source Files

I was looking for something very quick to find something specific in a ton of source files and I came across ripgrep.

But what is it?

ripgrep is a small command-line tool.

If you are a developer like me, you would certainly want to search in one of your source files for something you did a long time ago but you don't remember where?

ripgrep will do this work for you, but on top of that, you can use "Regular Expression" patterns! It will also ignore all files that are in a GIT repository if you have created a .gitignore file!

Honestly, I tested this in a directory of over 35,000 files, and in two seconds it gave me a result! Impressive!

How does it work?

Open a command window. (on PC -> Windows key + R, then type CMD)

Once the window is open, type this:

rg.exe [PatternRegEx] [Folder Path] (put quotes around your path if it contains spaces)

USAGE:

    rg [OPTIONS] PATTERN [PATH ...]
    rg [OPTIONS] [-e PATTERN ...] [-f PATTERNFILE ...] [PATH ...]
    rg [OPTIONS] --files [PATH ...]
    rg [OPTIONS] --type-list
    command | rg [OPTIONS] PATTERN

or in my example here: rg.exe fa\-lock "D:\My Projects\digital3d_com\www.digital3d.com\Controllers"

the simple Regex pattern here is "fa\-lock" (an escape character for the dash which is recognized as a special Regex character)

Command Line ripgrep

Not only will it give you the name of the file but also the line where it found your pattern! And at an astonishing speed! ;)

Honestly, this is a tool that I will quickly install in C:\Windows\System32 to always have it with me.

You can download it here: https://github.com/BurntSushi/ripgrep/releases/tag/11.0.0

Aucun commentaire pour le moment.

Une erreur s'est produite. Cette application peut ne plus répondre jusqu'à ce qu'elle soit rechargée.Veuillez contacter l'auteur. Reload 🗙