Article 599QY Displaying the cell in different color

Displaying the cell in different color

by
nextStep
from LinuxQuestions.org on (#599QY)
Hi Team,

My requirement is to display the value of html cell in red color based on the value in another cell .
Example:The value in the column "Actual count" should be displayed in red color as it is greater than value in "threshold" column.
The content of testresult.txt are as follows
Properties 20201020 281899 32000 Warning

Code:fn_presentationLogic()
{

awk 'BEGIN{
FS=" "
print "<HTML>""<TABLE border="1"><TH>Item</TH><TH>Date</TH><TH>Actual count</TH><TH>Threshold</TH><TH>Status</TH> "
}
{
printf "<TR>"
for(i=1;i<=NF;i++)
printf "<TD>%s</TD>", $i
print "</TR>"
}
END{
print "</TABLE></BODY></HTML>"
}
' testresult.txt > HotelDashboard.html

sed -i "s/Warning/<font color="red">$3<\/font>/g;s/Normal/<font color="green">$3<\/font>/g" HotelDashboard.html
}
fn_presentationLogicI have used the above sed command to substitute the third cell if it finds "Warning" but in vain. Could you please advise.latest?d=yIl2AUoC8zA latest?i=VNIptgfh0-g:2VLvhBPJVJQ:F7zBnMy latest?i=VNIptgfh0-g:2VLvhBPJVJQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=VNIptgfh0-g:2VLvhBPJVJQ:gIN9vFwVNIptgfh0-g
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments