htmltable

htmltable is a configurable way to generate HTML tables from, for example, command output, ASCII text files, etc.
Download

htmltable Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Kevin Waldron
  • Publisher web site:
  • http://www.zazzybob.com/sh_config.html

htmltable Tags


htmltable Description

htmltable is a configurable way to generate HTML tables from, for example, command output, ASCII text files, etc. htmltable is a configurable way to generate HTML tables from, for example, command output, ASCII text files, etc. The project requires that all input lines have equal numbers of fields. The first line of input is assumed to be a header line. ConfigurationThe configuration file for htmltable can take one of two forms, as defined by the "BGSTYLE" variable. A BGSTYLE of "ALT" would have each row with an alternating background colour, defined by the variables BGCOLOR1 and BGCOLOR2. If a BGSTYLE of "NORMAL" is defined, then use the BGCOLOR variable to set the background colour of all rows. Standard HTML colour values should be used. Other variables that are mandatory are CELLSPACING and BORDER. Optional HEADERCOLOR and TABLEBG values can also be defined. Sample configuration files are included in the tarball, and if enough interest in htmltable is shown I will get around to writing some decent documentation! NotesYou'll need to set "BASEDIR" appropriately within the script (line 15). The htmltable script has the following usage: Usage: htmltable.sh infile -c - conf file - defaults to $BASEDIR/$CONFDIR/htmltable.conf -d - delimiter - defaults to 't' This script is designed to grab simple delimited plain text data and format as tabular HTML output It can also be used to place command output in an HTML table, but requires more work and pre- processing, as each situation for command output is different... kevin@foo ~/htmltable $ df -hP | tr -s ' ' | sed 's/Mounted on/Mounted on/' > in/df.inkevin@foo ~/htmltable $ ./bin/htmltable.sh -c ./conf/htmltable.conf -d' ' ./in/df.in As you can see, even for a simple df listing, we need to do a few things in order to get the listing in a parsable format. First, we need to ensure that df outputs in -P (portability) mode, which ensures that each line isn't wrapped. Then, we use tr to -s (squeeze) the spaces. Next, we use sed to replace "Mounted on" with "Mounted on" which ensures that we can use a space as our delimiter, whilst still displaying the space in the outputted HTML. Other formats require different approaches, e.g. kevin@foo ~/htmltable $ cat > /tmp/headerdevice mountpoint type options^Dkevin@foo ~/htmltable $ mount | sed -e 's/ on//' -e ' s/ type//' | cat /tmp/header - > mount.inkevin@foo ~/htmltable $ ./bin/htmltable.sh -c ./conf/htmltable.conf -d' ' ./in/mount.in We can then test this.... kevin@foo ~/htmltable $ ( echo ""> ./bin/htmltable.sh -c ./conf/htmltable.conf -d' ' ./in/mount.in > echo "" ) /tmp/infile.html Then browse /tmp/infile.html


htmltable Related Software