Ripgrep: output as grep

Created on 31 Oct 2018  路  4Comments  路  Source: BurntSushi/ripgrep

What version of ripgrep are you using?

ripgrep 0.10.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

How did you install ripgrep?

cargo

What operating system are you using ripgrep on?

KDE.

Describe your question, feature request

option to put the file name on the same line as the search result, multiple time, as grep does, which makes it a drop in replacement rather than another tool to handle in a special way.

question

Most helpful comment

ripgrep has many many options to control the output format. rg --no-heading -N will give you output that looks like grep -R. This is also the format used by default when the output is being directed into a file or pipe. You can put those options in an alias or your ripgrep config file if you want it to always work like that. All of this is mentioned in the usage help, the guide, &c.

Also, i think @BurntSushi might point out that ripgrep is explicitly not designed to be a 'drop in replacement' for grep, although it can work like that in some cases. This is discussed in a few places in the documentation, but especially here

All 4 comments

ripgrep has many many options to control the output format. rg --no-heading -N will give you output that looks like grep -R. This is also the format used by default when the output is being directed into a file or pipe. You can put those options in an alias or your ripgrep config file if you want it to always work like that. All of this is mentioned in the usage help, the guide, &c.

Also, i think @BurntSushi might point out that ripgrep is explicitly not designed to be a 'drop in replacement' for grep, although it can work like that in some cases. This is discussed in a few places in the documentation, but especially here

Unfortunately --no-heading does not include a following the :, making IDE ctrl+click navigation fail. I haven't dipped into rust yet or I'd submit a PR.

@jacobisaliveandwell probably your IDE could be smarter about this; grep does not add a space either.
You could add it using rg foo --no-heading --column | sed -E 's/^[^:]*:([0-9]+:){2}/& /g'

Indeed. My apologies. grep does this too. Something must have changed in vscode. disregard me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chopfitzroy picture chopfitzroy  路  3Comments

hauleth picture hauleth  路  3Comments

danpintara picture danpintara  路  3Comments

mllg picture mllg  路  3Comments

Offpics picture Offpics  路  3Comments