#!/bin/sh # # mktbl: make a deck table, with rules # # input is a tab-separted list of columns, one line per row. # The first record specifies the position (in percentages) and alignment of the columns. # for example, # # 10:left40:right60:center # Item AItem BItem C # # specifies three columns beginning at 10, 40, and 60%, aligned left, right, and center # awk ' BEGIN { showrule=1 FS="\t" y=90 linespacing=7 textsize=3 tightness=3 } NR == 1 { for (i=1; i <= NF; i++) { split($i, c, ":") colx[i]=c[1] align[i]=c[2] } next } { ty=y-(linespacing/tightness) for (i=1; i <= NF; i++) { printf "%s\n", colx[i], y, textsize, align[i], $i } if (showrule) { printf "\n", colx[1], ty, colx[NF]+5, ty } y -= linespacing }' $*