#!/usr/bin/gawk -f #/* vim: set filteype=awk : */ -*- awk -*- BEGIN{ FS = " *, *"; OFS= " "; nums=0; print "\\scriptsize" print "\\begin{figure} [p]" print "\\begin{center}" print "\\begin{tabular}{|c|ccc|c|} \\cline{1-5}" } NF==1{ if (nums > 0) { print "\\cline{1-5}" print "\\end{tabular}" print "\\end{center}" print capt print lbl print "\\end{figure}" if (nums % 6 == 0) { print "\\clearpage"} print "\\begin{figure} [p]" print "\\begin{center}" print "\\begin{tabular}{|c|ccc|c|} \\cline{1-5}" } split(FILENAME, parts, ".") sub("all", "" , parts[1]) sub("tbl", "", parts[1]) sub("/.*\//", "", $0) split($0, some, " ") split(some[1], file, "/") capt="\\caption{" file[2] " for " parts[1] "}" lbl="\\label{fig:" file[2] "-" parts[1] "}" nums++ } NF==5{ if($0 ~/#key/) { sub("[ \t\n]*#", "", $1) print "\\textit{" $1 "}& \\textit{" $3 "}& \\textit{" $4 "}& \\textit{" $2 "}& \\textit{" $5 "}\\\\\\cline{1-5}" } else { print $1 "& " $3 "& " $4 "& " $2 "& " $5 "\\\\" } } END{ if (nums > 0) { print "\\cline{1-5}" print "\\end{tabular}" print "\\end{center}" print capt print lbl print "\\end{figure}" print "\\normalsize" } }