Skip to content

How to elimilate the file path before each line of the search results when redirecting rg to a file or pager(less) #2110

Answered by BurntSushi
AstroShen asked this question in Q&A
Discussion options

You must be logged in to vote

Works fine for me:

$ echo test > foo

$ echo test > bar

$ rg test
foo
1:test

bar
1:test

$ rg test --no-filename
1:test

1:test

$ rg test > /tmp/rg-with-file.log

$ rg test --no-filename > /tmp/rg-without-file.log

$ cat /tmp/rg-with-file.log
foo:test
bar:test

$ cat /tmp/rg-without-file.log
test
test

You'll need to provide a more specific reproduction. Try the above commands, for example.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants