all: \ cleanup \ inventory.pdf inventory.pdf: inventory.txt cat inventory.txt \ | gawk \ ' BEGIN { n=0 } \ /^[ ]*([\#]|$$)/ { print; next; } \ /[\|]/ { \ if (n == 3) { printf "---+---+---+---\n"; n = 0; } \ print; n++; \ next \ } \ //{ printf "** bad format\n"; print; next; } \ END{ printf "---+---+---+---\n"; } \ ' \ | txtable-reformat \ | text-to-pdf.sh \ > inventory.pdf cleanup: rm -fv inventory.pdf