HACKER Q&A
📣 totetsu

History |sort |uniq |Awk '{print $1;}' |uniq -C |sort -n |tail -10 ?


History |sort |uniq |Awk '{print $1;}' |uniq -C |sort -n |tail -10 ?


  👤 ratsmack Accepted Answer ✓
Maybe this?

    history | awk '{h[$2]++} ; END {for (i in h) print h[i], i}' | sort -n | tail -10

👤 yorwba
My output:

    613 cat
    623 ls
    875 rg
    996 sudo
   1037 vlc
   1079 cd
   1190 rm
   1219 make
   1330 vim
   4812 git

👤 rsclient
Sort line of text | filter to only print unique lines | print just the first word of each line | filter the print just the unique lines and the count | sort the counts numerically | print the top 10

Given a bunch of lines of text, this reports on the frequency of first starting words.

Probably the -C should be lower case?


👤 ratsmack
Maybe this?

    history | sort | uniq | awk '{print $2;}' | uniq -c | sort -n | tail -10