#!/bin/sh gawk ' @include "scripts/getcls.awk" function getsup(i, s) { switch (i) { case 1: s = "D" break case 2: s = "P" break case 3: s = "S" break } return "@sup{-" s "}" } BEGIN { FS = "\t" } { printf "trX { td .missing colspan=\"2\" {-%s}", $3 split($2, a, / /) for (i = 1; i <= length(a); i++) printf "td .%s colspan=\"1\" {-%s %s}", getcls(a[i]), $1, getsup(i) print "}" } END { print "__MARKER__" } ' data/world/pds.us \ | scripts/last-of-design.sed