I am trying to convert delimited data format to html column table output for email printing and I am unsure how to use pipe delimiter as a separater for HTML tabular formatting.
Below is what I could use if a space was a separator, but in this example I am using a pipeline (|).
awk ' BEGIN {
print "To: '[email protected]'"
#print "MIME-Version: 1.0"
print "Content-Type: text/html"
print "Subject: This is a test email"
print "<html><body><table border=1 cellspacing=0 cellpadding=3>"
print "<tr>"
print "<td>SID</td>";
print "<td>PID</td>";
print "<td>Username</td>";
print "<td>Database</td>";
print "<td>Hostname</td>";
print "<td>Program</td>";
print "<td>Connected</td>";
print "<td>Idle Time</td>";
print "<td>Query Time</td>";
print "<td>EST COST</td>";
print "<td>SEQ SCAN</td>";
print "<td>Query</td>";
print "</tr>"
} {
print "<tr>"
print "<td>"$1"</td>";
print "<td>"$2"</td>";
print "<td>"$3"</td>";
print "<td>"$4"</td>";
print "<td>"$5"</td>";
print "<td>"$6"</td>";
print "<td>"$7"</td>";
print "<td>"$8"</td>";
print "<td>"$9"</td>";
print "<td>"$10"</td>";
print "<td>"$11"</td>";
print "<td>"$12"</td>";
print "</tr>"
} END {
print "</table></body></html>"
} ' /home/test/test.unl | sendmail -t
Inside the test.unl file is the below:
15422216|-1|dwhvo|test|pd244zax.test.corp|N/A| 10:56:53| -0:00:30|10:57:22|1045127|1|SELECT sba_sub_aux.sba_subscriber_id, sba_sub_aux.sba_id_number, sba_sub_aux.sba_matchcode, sba_sub_aux.sba_marketing, sba_su|
I would like to achieve the below in table format via email.

awk -F'|'....