You are here: Home → Forums → Challenge Suggestions → Shell History in Ruby
Add a reply
~ $ history | ruby -e '$<.inject(Hash.new(0)){|h,l| h[l.split[1]] += 1; h}.sort{|a,b| b[1]<=>a[1]}[0..9].each{|k,v| puts "#{v} #{k}"}' 138 cd 55 ls 40 merb 31 mate 29 cat 19 mv 17 httperf 15 rm 14 ant 14 rake
A 29degrees diversion |
~ $ history | ruby -e '$<.inject(Hash.new(0)){|h,l| h[l.split[1]] += 1; h}.sort{|a,b| b[1]<=>a[1]}[0..9].each{|k,v| puts "#{v} #{k}"}'138 cd
55 ls
40 merb
31 mate
29 cat
19 mv
17 httperf
15 rm
14 ant
14 rake