Skip to main content
6 events
when toggle format what by license comment
Nov 4, 2023 at 13:58 comment added Hi-Angel The whole point of the question is exactly that the -c option does not work.
Aug 6, 2021 at 21:52 comment added user3730 @rugk You completely missed the first sentence in OP's post, which explicitly explains that -c only counts one occurrence per line. If a string occurs 1000 times on the same line, grep -c will still only count it as one. This answer makes no sense at all for this question.
Aug 6, 2020 at 20:03 comment added rugk This should be the accepted answer. No need to use wc -l, grep has a built-in option to count things, and it is even named as obvious as -c for “count”!
Jul 15, 2018 at 18:20 history edited OJFord CC BY-SA 4.0
added 42 characters in body
Jul 11, 2018 at 2:29 comment added Steve Gore I'm not sure you're actually checking it's only appearing once? All you're looking for there is that either one of those words exist at least once.
Jan 13, 2017 at 13:20 history answered OJFord CC BY-SA 3.0