diff options
Diffstat (limited to 'tabize')
-rwxr-xr-x | tabize | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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 |