by anon_mouse · 8y ago · 0 comments
but when I try to save it as an alias method.. I keep getting error:
awk: cmd. line:1: {CMD[]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;} awk: cmd. line:1: ^ syntax error awk: cmd. line:1: error: invalid subscript expression
I thought I would just escape the double quotes ", and things would work. :/ Any ideas?
alias mostused='history | awk '\''{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}'\'' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10'Use a shell function instead of an alias, that's the better tool here.