-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Have a --count option that counts occurrences instead of matched lines: #566
Comments
Seems reasonable I guess. Maybe a |
I personally would prefer a |
Would it make sense to just tie the behaviour to If i wasn't already familiar with |
Hmm. I guess I feel like |
-o is totally unrelated to counting. I just used it to make the example simpler. My current problem is searching inside binary files where we see many matches on each "line" because counting lines on binary files seems very wrong (but the material of another bug request).... but I have use for both behaviors even on text files. for me --count and --count-matches seems the way to go. |
Yeah, but it doesn't have to be. It literally tells idk, i don't feel super strongly about it, so that's all i'll say. Just thought i'd mention that that's how my intuition would've told me it should behave. |
BurntSushi#566 to implement match counting
I had a look at this (while looking a the code for the Another thing to note about the behaviour of
If we do want this, shall I put it behind |
@balajisivaraman I don't know the right answer here. Part of me leans toward Also, I think @okdana was pointing out that |
Ah, that does make a lot of sense. My bad for misunderstanding. I'll begin work under the assumption that we want |
I was actually suggesting that |
I don't see why it can't be both.
Adding a blurb in the |
@okdana Yeah I know, but I definitely feel a compelling attraction to match grep's behavior in subtle cases like this. But you and @kbknapp present strong arguments, and I like @kbknapp's suggestion for having both. @balajisivaraman If you want to start with |
One question I have is how should
Do we want |
@balajisivaraman The |
Right now -c/--count counts line matches, it would be great to have an option to count matches and not lines matched. Looking at the example:
would be interesting to have a way to get the total matches (2) in this case.
The text was updated successfully, but these errors were encountered: