I have data like below in a csv file
ServerName,Index,Status
10.xxx.xx.xx,1.5.1.1,2
10.xxx.xx.xx,1.5.1.2,3
I need to convert this data to html and also color the row if the value of the "Status" is 3/4/5.. please help me in this. tried below
awk 'BEGIN{
FS=","
print "<HTML>""<TABLE border="1"><TH>JOB_NAME</TH><TH>RUN_DATE</TH><TH>STATUS</TH>"
}
{
printf "<TR>"
for(i=1;i<=NF;i++)
printf "<TD>%s</TD>", $i
print "</TR>"
}
END{
print "</TABLE></BODY></HTML>"
}
' 10.106.40.45_FinalData.csv > file.html
sed -i "s/2/<font color="green">2<\/font>/g;s/4/<font color="red">4<\/font>/g;s/5/<font color="red">5<\/font>/g;" file.html
in the latest code i tried, i need to check the value of the status column only and need to color the cell.