I have to sort all of the words from a file given as parameter in a shell script. Here is the one-liner:
tr [:space:] '\n' <$1 | sort -nrk2,2 | uniq -c |sed 's/^ \+//g'
Basically, if I have something like this in my file:
bla bla bla bla hu hu hu
It will output
4 bla 3 hu
I want them to be something like
bla 4 hu 3