X-Git-Url: http://git.scottworley.com/tablify/blobdiff_plain/606198161ee2305f65881c1b34f3eceab169436a..ede6233355b70ac831aa79949e0b396ba6320b99:/log2table.awk diff --git a/log2table.awk b/log2table.awk new file mode 100644 index 0000000..5188c81 --- /dev/null +++ b/log2table.awk @@ -0,0 +1,75 @@ + +# TODO: Implement quoting properly +function quote_html(s) { return s; } +function quote_html_attribute(s) { return gensub("\"", """, "g", s) } + +BEGIN { + FS = ":" + num_rows = 0 + num_cols = 0 + read_header = 1 + # h/t https://wabain.github.io/2019/10/13/css-rotated-table-header.html + print "
| " + for (i=0; i < num_cols; i++) { + printf " | %s | ", quote_html_attribute(col_headers[i]), quote_html(col_headers[i])
+ }
+ print "
|---|---|
| %s | ", quote_html_attribute(row_header), quote_html(row_header) + for (j = 0;j < num_cols; j++) { + printf "" rows[i][j] " | " + } + print "