1

Trying to create a script that creates HTML from a TXT (which is converted from a coma separated CSV) but i get the syntax error on the first print "\ the mark shows " but i cant find the reason why any clues?

awk 'BEGIN {
 FS=","
 print "<style>\
    .my_table {font-size:8.0pt; font-family:\"Verdana\",\"sans-serif\"; border-bottom:3px double black; border-collapse: collapse;
}\n\
     .my_table tr.header{border-bottom:3px double black;}\n\
     .my_table th {text-align: left;}\
 </style>"
 print "<table class=\"my_table\">"
}
NR == 1{
 print "<tr class=\"header\">"
 tag = "th"
}
NR != 1{
 print "<tr>"
 tag = "td"
}
{
 for(i=1; i<=NF; ++i) print "<" tag " width=\"" widths[i] "\">" $i "</" tag ">"
 print "</tr>"
}
END { print "</table>"}' dataset.txt > document.html

1 Answer 1

1

You missed quoting EOL or mistyped newline here: collapse;}

Sign up to request clarification or add additional context in comments.

1 Comment

thanks! yes that was it! :) problem seem to be that!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.