I like to use the unix command
grep -c (print a count of matches) on multiple files at a time, but it displays the count for
each file. I want a total count, so I call on Perl. Pipe the output of
grep -c PATTERN file1 file2 ... to this snippet.
update: don't use this, use
blakem's
better solution below.