Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

With sort $file | uniq -c, it's possible to sum up files/input and show the number occurences like that:

 13     foo
  1     bar

To get a better grasp of this data, I'd like to see them graphically like git does when showing changes (++++++++--):

------------ foo
-            bar
------       baz
share|improve this question

1 Answer 1

up vote 2 down vote accepted

A little search gave me that, which works beautifully, just adapt the name of your input file:

uniq -c YOURFILE|awk '{print $2}'|sort|uniq -c|sort -rn|head -20|awk '!max{max=$1;}{r="";i=s=60*$1/max;while(i-->0)r=r"#";printf "%15s %5d %s %s",$2,$1,r,"\n";}'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.