Re:Ask HN: What's your speciality, and what's your "FizzBuzz...
by smokey42 on Thursday January 02, 2014 @10:55AM
(#7000156)
My pet problem after FizzBuzz has been this for some time now:
This can be depressing at times.
[ Parent
| on HN ]
Re:Ask HN: What's your speciality, and what's your "FizzBuzz...
by ColinWright on Thursday January 02, 2014 @11:00AM
(#7000189)
Define "word". However, strings separated by space:
Print number of words:
wc -w <filename>
Print words with counts in decreasing order: cat <filename> \
| gawk '{for (i=1;i<=NF;i++) print $i}' \
| sort \
| uniq -c \
| sort -rn \
| less
There are optimizations to be made, but that would be my go to solution in the first instance.