in reply to sum of counts from unix grep -c

I like it.... You could do the whole thing in perl though, giving you more powerful regexes...
% perl -ne '$sum += /pattern/}{print $sum,$/' file1 file2 file3
Or, perhaps something as evil as:
% perl -lpe '$\+=/pattern/}{$\.=$/' file1 file2 file3

-Blake

Replies are listed 'Best First'.
(sacked) Re: Re: sum of counts from unix grep -c
by sacked (Hermit) on Jan 18, 2002 at 05:08 UTC
    Great! Thanks very much. I completely overlooked the fact that I could use Perl for counting.

    --sacked