Need help on script
A shell script to convert any file or command output into a html table
Brought to you by:
nathan-sr
Hi Nathan, Thanks for this post, it helped me in fixing my task. This script is really great!!!!!
But i will ask for your more help in this script.
Please check attached screenshot. In third column "Status", for FAIL and PASS, i have to update the color of text. If PASS, text should be in green color and for FAIL, it should be in Red color.
Sorry i have zero knowledge in html and tried customization in your code, but no luck. Requesting your help in attaining my requirement. Thanks in advance.
Hi,
It is very easy. Just open your output.html file in a text editor and search for PASS, substitute its
Save the file and open / check its color in your internet browser. That's it.
All these solutions are readily available in internet. Use Google Search like this :
https://www.google.com/search?q=html+table+text+color+code
https://www.google.com/search?q=red+color+code
https://www.google.com/search?q=green+color+code
https://stackoverflow.com/questions/44248294/how-do-i-change-the-font-color-in-an-html-table
Last edit: Nathan S.R. 2021-10-23
Hi Nathan, Thanks a lot for the response. I tried this already and able to achieve changing color by editing in output html. But here in my case, a script will be executed and it will create a csv file. Then that script will invoke your conversion script and convert csv to html table and upload the output to azure storage table. Users will download the html report and view the status. My requurment is, html conversion script have to change the color of text in table if it contains Red. Like adding a if condition in html conversion script, to change the text color of fail alone. Please let me know if you can help me in this. It will be of great help of i could achieve this. Thanks in advance!!!
Hi Imran,
That is easy as well. Before writing the final output html file, pipe it to the sed substitute command like below, dynamically ( Just copy and paste the whole line carefully ) :
This was obtained from google search as well, with my own modifications.
https://www.google.com/search?q=linux+sed+replace+html+td
https://stackoverflow.com/questions/44375804/search-and-replace-with-sed-does-not-work-with-html-tags
Regards,
Nathan SR