git.samba.org
/
tridge
/
junkcode.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a4a0ecd
)
perl version of histogram prog
author
Andrew Tridgell
<tridge@samba.org>
Fri, 12 Feb 2010 00:16:14 +0000
(11:16 +1100)
committer
Andrew Tridgell
<tridge@samba.org>
Fri, 12 Feb 2010 00:16:14 +0000
(11:16 +1100)
histogram.pl
[new file with mode: 0755]
patch
|
blob
diff --git a/histogram.pl
b/histogram.pl
new file mode 100755
(executable)
index 0000000..
9a85b62
--- /dev/null
+++ b/
histogram.pl
@@ -0,0
+1,25
@@
+#!/usr/bin/perl -w
+
+my %data;
+my $total = 0;
+
+while (<>) {
+ my $v = $_;
+ chomp($v);
+ $data{$v}++;
+ $total++;
+}
+
+my $accum = 0;
+my $line = 0;
+
+foreach my $v (sort { $data{$a} <=> $data{$b} } keys %data) {
+ $accum += $data{$v};
+ printf "%d (%.0f%% / %.0f%%) %s (%u)\n",
+ $data{$v},
+ (100*$data{$v})/$total,
+ (100*$accum)/$total,
+ $v,
+ $line;
+ $line++;
+}