4 ms·
Ask HN: History |sort |uniq |Awk '{print $1;}' |uniq -C |sort -n |tail -10 ?
- ratsmack 6y agoMaybe this? history | sort | uniq | awk '{print $2;}' | uniq -c | sort -n | tail -10
- rsclient 6y agoSort 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?
- totetsu 6y agoIn this case, the frequency of utils in your shell history.
- ratsmack 6y agoMaybe this? history | awk '{h[$2]++} ; END {for (i in h) print h[i], i}' | sort -n | tail -10
- yorwba 6y agoMy output: 613 cat 623 ls 875 rg 996 sudo 1037 vlc 1079 cd 1190 rm 1219 make 1330 vim 4812 git