begin  quoting Andrew Lentvorski as of Tue, Feb 20, 2007 at 03:27:34PM -0800:
> I'm doing a lot of work with truth tables and digital logic for my 
> class.  I'm really beginning to loathe creating tables by hand.
> 
> Anybody have any suggestions for a way to enter data in a nice tabular 
> form and then have a program spit out either a <table></table> or 
> <div></div> HTML file?

Given a tab-delimited file for input, something like:

-----------------------------------------------------------------------------
#!/bin/sh

in=$1
out=$2

echo '<table border="1">' >> $out

sed -e 's:\t:</td><td>:g' $in \
   | sed -e 's/^/<tr><td>/'   \
   | sed -e's:$:</td></tr>:'  >> $out

echo '</table>' >> $out
-----------------------------------------------------------------------------

...has generally worked for me.  

-- 
Don't write html, write programs that write html.
Stewart Stremler


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to