Ripgrep: Add filename-only option

Created on 26 Sep 2016  路  4Comments  路  Source: BurntSushi/ripgrep

I quite frequently use grep -l to simply identify files which contained any match of the given pattern. Since only existence checking is required, you could terminate at the first match. The list of files can then be fed to xargs or the like. This would go hand-in-hand with the -0, --null option.

Most helpful comment

To be clear for folks who stumbled upon this like I did, the way to only show filenames in rg is the same as in grep:

$ rg -l 

All 4 comments

This is already done. It's in 0.2.0.

To be clear for folks who stumbled upon this like I did, the way to only show filenames in rg is the same as in grep:

$ rg -l 

Here's the relevant help section from ripgrep 12.1.0:

    -l, --files-with-matches
            Only print the paths with at least one match.

            This overrides --files-without-match.

Maybe helpful to know that adding the flag -c/--counter will show the number of lines matching the searched term. The flag --count-matches will count the number of matches instead (see man page).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chopfitzroy picture chopfitzroy  路  3Comments

crumblingstatue picture crumblingstatue  路  3Comments

Limeth picture Limeth  路  3Comments

bastienbc picture bastienbc  路  3Comments

andschwa picture andschwa  路  3Comments