draw bar graph for input values v0.10
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 23 Mar 2007 15:08:59 +0000 (16:08 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 4 Sep 2019 13:53:10 +0000 (15:53 +0200)
Written as one-liner to visualise output from uniq -c (i.e. git history).

graph [new file with mode: 0755]

diff --git a/graph b/graph
new file mode 100755 (executable)
index 0000000..fbc1248
--- /dev/null
+++ b/graph
@@ -0,0 +1,6 @@
+#!/usr/bin/perl -l
+use List::Util 'max';
+chomp for my @r = <>;
+my $len = 1 + max map length, @r;
+my $size = (80 - $len) / max @r;
+print $_, ' 'x($len-length), '#'x($_*$size) for @r;