Reputation: 438
I am currently using a grep command:
zgrep -c 'hello' *2017-05-08*
Which counts the total no. of occurrences of the keyword with files having the following name within the **. For example, the output shows like:
log.2017-05-08-15.gz:0
log.2017-05-08-16.gz:0
log.2017-05-08-17.gz:1
It returns a list of files which has the number of occurrences.However, I want only the files which have more than 0 occurrences such as the third file above.
log.2017-05-08-17.gz:1
Can anyone please tell me how could I achieve the desired result. Please let me know if you have any questions
Thanks
Upvotes: 2
Views: 1745
Reputation: 442
maybe this isn't a good answer, but see if this works:
zgrep -c 'hello' *2017-05-08* | grep -v ":0"
Upvotes: 3