A better example is here... this should handle any number of fields and
insert a non-breaking space on fields with nothing in them, so as to
preserve table alignments.
Just paste it into a file on your shell, chmod +x the file, and run it.
This is again assuming the file is spreadsheet.txt (which can be easily
changed, last line.
Hope this is useful to somebody.
---- snip ----
awk '
BEGIN {
print "<TABLE>"
}
{
printf "<TR>";
split($0, temp, "\t")
for (field in temp)
{
if (length(field) == 0)
{
printf "<TD> </TD>"
} else {
printf "<TD>%s</TD>", field
}
}
print "</TR>"
}
END {
print "</TABLE>"
}
' spreadsheet.txt > output.html
---- end snip ----
Ryan Merton
NERDC Support Desk
392-2061 x140
[log in to unmask]
On Fri, 20 Dec 2002, Kristiina Butler wrote:
> I need to import Excel spread sheets into the web and would like to find a way to do it
> without having all the extra tags, style sheets and other junk on the page.
>
> Any advice?
>
> Kristiina Butler
> OIT - Network Services
> 392-2061
>
|