From af38cb02a9ca95b20056bc92e73fe72a45d1f523 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 23 Apr 2013 18:59:15 +0200 Subject: Initial checkin. --- tabize | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 tabize (limited to 'tabize') diff --git a/tabize b/tabize new file mode 100755 index 0000000..467581a --- /dev/null +++ b/tabize @@ -0,0 +1,30 @@ +#!/bin/sh +# Input: space-separated +column -t \ +| sed 's/ */&| /g' \ +| tac | awk 'BEGIN { + s=""; + line=""; +} +{ + if (line) print line; + if (s == "") { + split($0, chars, ""); + for (i=1; i<=length(chars); i++) { + if (chars[i] == "|") + s=s "+"; + else + s=s "-"; + } + } else { + while (length(s) < length($0)) { + s = s "-"; + } + } + line = $0; +} +END { + print s; + s=""; + print line; +}' | tac -- cgit v1.2.1