Hacker News new | past | comments | ask | show | jobs | submit login

Something similar to this;

history | perl -ne '/^\s*\d+\s+(\w+)/ && $a{$1}++; END { map { print "$a{$_} $_\n" } splice((sort {$b <=> $a} keys %a),0,10) }'

Oops, just realised it should be sorted by the value and not the key so...

history | perl -ne '/^\s*\d+\s+(\w+)/ && $a{$1}++; END { map { print "$a{$_} $_\n" } splice((sort {$a{$b} <=> $a{$a}} keys %a),0,10) }'

Also noticed that splice() isn't setting wantarray() so you'll need to use direct indexing which is probably easier to write too...

history | perl -ne '/^\s*\d+\s+(\w+)/ && $a{$1}++; END { map { print "$a{$_} $_\n" } (sort {$a{$b} <=> $a{$a}} (keys %a))[0..9] }'




Usually line noise like that is quickly followed by a "Remote disconnected..." message and I have to dial in again.


Sure, the same thing could be said about Chinese logograms if you don't understand it. Personally I prefer the compact symbology, it's somewhat like Lempel-Ziv tokenisation; it's a form of compression.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: