I have a bunch of log files. I need to find out how many times a string occurs in all files.
grep -c string *
returns
... f
Instead of using -c, just pipe it to wc -l.
grep string * | wc -l
This will list each occurrence on a single line and then count the number of lines.
This will miss instances where the string occurs 2+ times on one line, though.