Sponsored Content
Full Discussion: Output as a html file
Top Forums UNIX for Dummies Questions & Answers Output as a html file Post 302741457 by navsan on Sunday 9th of December 2012 12:54:46 AM
Old 12-09-2012
Required output
HTML Code:
<table style="background-color:lightblue;">
<tr style="background-color:blue;color:white;">
<th>Component</th><th>Status</th>
</tr>
<tr>
<td>UCM OBj MGR</td><td style="background-color:lightgreen;">Green</td>
</tr>
<tr>
<td>SR Broker</td><td style="background-color:Red;">Red</td>
</tr>
</table>
<p>failed:</p>
<p>PRDU UCM Object code app UCM  <b>Shutdown</b> Auto 0 20 1 1 2012-12-06 01:10:45 </p>
this wat i get:
HTML Code:
<table style="background-color:lightblue;">
<tr style="background-color:blue;color:white;">
<th>Component</th><th>Status</th>
</tr>
<tr>
<td>UCM OBj MGR</td><td style="background-color:lightgreen;">Green</td>
</tr>
<tr>
<td>SR Broker</td><td style="background-color:Red;">RedPRDU UCM Object code app UCM  <b>Shutdown</b> Auto 0 20 1 1 2012-12-06 01:10:45</td>
</tr>
</table>
ORIGINAL CODE
Code:
UCM=`cat output.log |grep UCM | egrep '(Running|Online)'|wc -l`
SRB=`cat output.log |grep SRB | egrep '(Running|Online)'|wc -l`

echo "<table border="2">"
echo "<tr>"
echo "<th>Component</th><th>Status</th>"
echo "</tr>"
if [ $UCM -eq 4 ]

then
     echo "<tr>"
     echo "<td>UCM</td>"
	 echo "<td style="background-color:lightgreen">GREEN</td>" 
	 echo "</tr>" 
else
     echo "<tr>"
     echo "<td>UCM</td>"
	 echo "<td style="background-color:Red"> Red </td>"
     echo "</tr>"
fi

if [ $SRB -eq 15 ]

then 
     echo "<tr>"
     echo "<td>SRB</td>"
	 echo "<td style="background-color:lightgreen">GREEN</td>" 
	 echo "</tr>" 
     
else
     echo "<tr>"
     echo "<td>SRB</td>"
	 echo "<td style="background-color:Red"> RED </td>"
     echo "</tr>"
	 echo "</table>"
	 
fi


while read LINE
 do
      echo $LINE | grep UCM | egrep '(Shutdown|Unavailable)'| tee HC_Report.txt
 done <output.log
	


cat - color.html <<HERE | /usr/lib/sendmail -oi -t
From: HC@admin.com
To:xyz@gmail.com
Cc:abc@gmail.com
Subject: HEALTH CHECK REPORT
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
HERE


Last edited by navsan; 12-09-2012 at 02:02 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

formatting output in html

hello all. I was hoping someone may have an idea or two. I'm throwing together a shell script that does a lot of application and system level data collection. The idea is is you run it before/after restarting an application for later analysis. A lot of stuff is collected... resource stats,... (4 Replies)
Discussion started by: ebbtide
4 Replies

2. UNIX for Dummies Questions & Answers

How do I extract text only from html file without HTML tag

I have a html file called myfile. If I simply put "cat myfile.html" in UNIX, it shows all the html tags like <a href=r/26><img src="http://www>. But I want to extract only text part. Same problem happens in "type" command in MS-DOS. I know you can do it by opening it in Internet Explorer,... (4 Replies)
Discussion started by: los111
4 Replies

3. Shell Programming and Scripting

awk script to search an html file and output links

hello. i want to make an awk script to search an html file and output all the links (e.g .html, .htm, .jpg, .doc, .pdf, etc..) inside it. also, i want the links that will be output to be split into 3 groups (separated by an empty line), the first group with links to other webpages (.html .htm etc),... (8 Replies)
Discussion started by: kyris
8 Replies

4. Shell Programming and Scripting

how to display the output file in an html format using perl

Hi, I have written a perl script to dispaly some statements from a file but i want the output statements to be dispalyed in an HTML format.Is it possible for me to do in perl scripting? Please help me with ur thoughts. Thanks In Advance Meva. (1 Reply)
Discussion started by: meva
1 Replies

5. Shell Programming and Scripting

Convert shell script output txt file to html table

Hi, I have script which generates the output as below: Jobname Date Time Status abc 12/9/11 17:00 Completed xyz 13/9/11 21:00 Running I have the output as a text file. I need to convert it into a HTML Table and sent it thru email ... (6 Replies)
Discussion started by: a12ka4
6 Replies

6. Shell Programming and Scripting

Removing all except couple of html tags from html file

I tried to find elegant (or at least simple) way to remove all but couple of html tags from html file, but all examples I found dealt with removing all the tags. The logic of the script would be: - if there is <li> or <ul> on the line, do nothing (=write same line to output) - if there is:... (0 Replies)
Discussion started by: juubuntu
0 Replies

7. Shell Programming and Scripting

Need to convert output.txt into html file

I have output.txt file generated through shell scripts which need convert in tabular format using html can you please help me output.txt Token State Date1 Date2 Description Name 34567 open 27/06/13 28/06/13 ... (5 Replies)
Discussion started by: vijay_rajni
5 Replies

8. UNIX for Dummies Questions & Answers

Help with redirecting output to an HTML file

I'm very new to shell scripting and am practicing how to write a script, then redirect the output into an HTML file, and then email both the script and the HTML file to myself. I have created a script called sysinfo_page, and thought it would have redirected the output into the sysinfo_page.html... (3 Replies)
Discussion started by: braing
3 Replies

9. Homework & Coursework Questions

Help with redirecting output to an HTML file

1. The problem statement, all variables and given/known data: I'm having trouble redirecting the output of my sysinfo_page script into my sysinfo_page.html file. The task at hand is to be able to email both the html file and the script to myself. I'm assuming that the html should appear as a web... (8 Replies)
Discussion started by: braing
8 Replies

10. Shell Programming and Scripting

Convert shell script output txt file to html table

My concnern related to the post -Convert shell script output txt file to html table, in this how to print the heading as color. awk 'BEGIN{print "<table>"} {print "<tr>";for(i=1;i<=NF;i++)print "<td>" $i"</td>";print "</tr>"} END{print "</table>"}' <filename> (8 Replies)
Discussion started by: sarajobmai
8 Replies
All times are GMT -4. The time now is 10:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy