perl -ne 's/\W+/$i++/eg;END{print "$i\n"}' f1 f2 [download]
In reply to Re^2: problem count the number of words -- oneliner by kschwab in thread problem count the number of words by GHMON