mirror of git://bitreich.org/reed-alert
New script converting tab separated output to html
This commit is contained in:
parent
e6d5e1bcf7
commit
5bd1f20ca1
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
awk -F'\t' \
|
||||
-v alert=1 \
|
||||
-v check=1 \
|
||||
-v params=1 \
|
||||
-v previousstate=1 \
|
||||
-v currentstate=1 \
|
||||
-v triggerstate=1 '
|
||||
|
||||
BEGIN {
|
||||
print "<html>"
|
||||
|
||||
print "<body>"
|
||||
print "<table><thead><tr>"
|
||||
if(alert) { print "<th>Alert</th>" }
|
||||
if(check) { print "<th>check</th>" }
|
||||
if(params) { print "<th>params</th>" }
|
||||
if(previousstate) { print "<th>previous-state</th>" }
|
||||
if(currentstate) { print "<th>current-state</th>" }
|
||||
if(triggerstate) { print "<th>trigger-state</th>" }
|
||||
print "</tr></thead><tbody>"
|
||||
}
|
||||
|
||||
{
|
||||
print "<tr>"
|
||||
if(alert) { print "<td>"$1"</td>" }
|
||||
if(check) { print "<td>"$2"</td>" }
|
||||
if(params) { print "<td>"$3"</td>" }
|
||||
if(previousstate) { print "<td>"$4"</td>" }
|
||||
if(currentstate) { print "<td>"$5"</td>" }
|
||||
if(triggerstate) { print "<td>"$6"</td>" }
|
||||
print "</tr>"
|
||||
|
||||
}
|
||||
|
||||
END {
|
||||
print "</tbody></table>"
|
||||
print "</body></html>"
|
||||
}'
|
Loading…
Reference in New Issue