in reply to Reporting entries in a file

The quick *nix solution use the sort and uniq utilities to produce a numerically sorted list of word counts:
sort file | uniq -c | sort -n

will print out something like:

1 foo 3 bar 8 blah

Replies are listed 'Best First'.
Re^2: Reporting entries in a file (unix one-liner)
by codeacrobat (Chaplain) on May 31, 2008 at 22:08 UTC
    If you are not in a *nix environment. This is a perl only oneliner.
    perl -lane '$h{$_}++ for @F; END{print qq{$h{$_} $_\n} for sort keys % +h}' file
    Switch to double quotes in Windows.

    print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});