2 ms·
Perl would also be a lot faster than the shell. It just does less work. So if the file is big, you would probably prefer Perl. perl -lne 'map { $words{lc $_}
by forinti 8y ago
Perl would also be a lot faster than the shell. It just does less work. So if the file is big, you would probably prefer Perl.
perl -lne 'map { $words{lc $_}++ } split /\W+/,$_ }{ print "$words{$_} $_" for (sort {$words{$a}<=>$words{$b}} keys %words)'