in reply to one liner to print out sorted list of word

First sort then uniq: sort|uniq.