Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A flag to make --count return 0 #1370

Closed
cebaa opened this issue Sep 8, 2019 · 0 comments
Closed

A flag to make --count return 0 #1370

cebaa opened this issue Sep 8, 2019 · 0 comments

Comments

@cebaa
Copy link

cebaa commented Sep 8, 2019

What version of ripgrep are you using?

ripgrep 11.0.1 (rev 973de50)

How did you install ripgrep?

Github binary release.

What operating system are you using ripgrep on?

Linux.

Describe your question, feature request, or bug.

With grep -cH needle app.log*, you get something like:

app.log.2019-08-24:0
app.log.2019-08-25:3
app.log.2019-08-26:5
app.log.2019-08-27:0

which is visually useful for cases such as "interesting things happened on 25th and 26th, but not on 24th and 27th".

The difference is in the "not on 24th and 27th" part - without rg outputting zero counts it's not possible to distinguish between:

  • No matches in those files
  • Those files do not even exist
  • You messed up a pattern and it's not matching files it should

It might be good to consider a flag to include zero counts as well. IMO it would help with sanity double-checks.

BurntSushi pushed a commit that referenced this issue Feb 15, 2020
This flag, when used in conjunction with --count or --count-matches,
will print a result for each file searched even if there were zero
matches in that file. This is off by default but can be enabled to make
ripgrep behave more like grep.

This also clarifies some of the defaults for the
grep-printer::SummaryBuilder type.

Closes #1370, Closes #1405
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant