Ripgrep's output when used with fd

I have ~/Downloads/news.txt which contains “libxml2”.

If I run rg libxml2 from my home folder, I get

Downloads/news.txt
19:2021-12-27 libxml2>=2.9.12-6 update may require manual          Jan Alexander

But if I run fd -g news.txt -x rg libxml2 from my home folder, I get just

2021-12-27 libxml2>=2.9.12-6 update may require manual          Jan Alexander

In other words, when used in conjunction with fd, rg provides less information:

  • The relative path, Downloads/news.txt, is missing.
  • The line number, 19 is missing.

Is there a way to get the combination of fd+rg to show the information rg would show when run alone?

Try now:

fd -e txt -X rg libxml2
./Downloads/news.txt
19:2021-12-27 libxml2>=2.9.12-6 update may require manual          Jan Alexander
1 Like

Use -X instead of -x.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.