#!/usr/bin/awk -f # Converts from a rdbtable text table to HTML. # There may be zero or more comment lines before the headings. # Next comes a single line of headings. # Each column heading must be exactly one word. # Then come the data lines, i.e. the rows. # Eric Blossom - January 2002 # see http://www.cse.ucsc.edu/research/compbio/rdb/rdbtable.html # Only the justification (left or right) is used from the column format line. # e.g. # # First comment # one two three # column names # 12 1S> 6N # column formats # 1 2 3 # data # 4 x 6 # data BEGIN { FS = "\t"; firstComment = 0; titleLine = 1; fmtLine = 2; colAlignment[1] = ""; colComment[1] = ""; } /^(# )|( *#)/ && 0 == firstComment { firstComment = NR; print "
";
}
/^(# )|( *#)/ {
match( $0, "^(# )|( *#)" );
print substr( $0, RLENGTH+1 );
titleLine++;
fmtLine++;
next;
}
titleLine == NR {
if ( 0 < firstComment ) {
print "";
}
print "| %s | ", $i ); } print "
|---|
| %s | ", tagAttributes, $i ); } print "