Hi folks,
I am writing an awk script that will take the output of grep and nicely format that into an HTML table. The delimiter is the ":" character; the problem I'm running into is that that character can appear in the text as well. So if I just use $1, $2, and $3 for the filename, line number, and comment respectively, I lose anything after the first : in the comment
Is there a way to say $1, $2, and then $3..NR without explicitly looping over the columns and concatenating them together?
Here's the script so far:
`
#!/usr/bin/awk
BEGIN {
FS=":"
print "<html><body>"
print "<table>"
print "<tr><td>File name</td><td>Line number</td><td>Comment</td></tr>"
}
{
print "<tr><td>" $1 "</td><td>" $2 "</td><td>" $3 "</td></tr>"
}
END {
print "</table>"
print "</body></html>"
}`
And some sample input:
./mysql-connector-java-5.0.8/src/com/mysql/jdbc/BlobFromLocator.java:177: // TODO: Make fetch size configurable
./mysql-connector-java-5.0.8/src/com/mysql/jdbc/CallableStatement.java:243: // TODO Auto-generated method stub
./mysql-connector-java-5.0.8/src/com/mysql/jdbc/CallableStatement.java:836: // TODO: Do this with less memory allocation