home
/
code
/
khome.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ec81fc0
)
Implement simple textual barplot
author
Siraaj Khandkar
<siraaj@khandkar.net>
Mon, 23 Dec 2019 22:04:40 +0000
(17:04 -0500)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Mon, 23 Dec 2019 22:04:40 +0000
(17:04 -0500)
home/bin/barplot
[new file with mode: 0755]
patch
|
blob
diff --git a/home/bin/barplot
b/home/bin/barplot
new file mode 100755
(executable)
index 0000000..
dce8325
--- /dev/null
+++ b/
home/bin/barplot
@@ -0,0
+1,22
@@
+#! /bin/sh
+
+set -e
+
+awk '
+ {
+ v = val[NR] = $1
+ key[NR] = $2
+ if (v > max)
+ max = v
+ }
+
+ END {
+ for (i = 1; i <= NR; i++) {
+ printf "%s ", key[i]
+ for (j = 1; j <= (val[i] * 100) / max; j++) {
+ printf "|"
+ }
+ printf "\n"
+ }
+ }' \
+| column -t
This page took
0.024209 seconds
and
4
git commands to generate.