Not getting colorcode when excuting html in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not getting colorcode when excuting html in UNIX
# 1  
Old 08-04-2016
Not getting colorcode when excuting html in UNIX

Hi
i have below code which i am running and the out i want should be in red color

Code:
echo "<html>" >> ERROR_FILE.html
echo "<Body>" >> ERROR_FILE.html

nawk 'BEGIN{print "<table border="1">"}
       {print "<tr>";
       print "<TD colspan="0" bgcolor="#DC143C">";
       for(i=1;i<NF;i++) printf("%s ",  $i);
       print "</TD>";
       print "<TD colspan="0" bgcolor="#DC143C">" $NF "</TD>";
       print "</tr>"}
     END{print "</table>"}'  ERROR_FILE.log >> ERROR_FILE.html ##URLs with ports which are having error

echo "</Body>" >> ERROR_FILE.html
echo "</html>" >> ERROR_FILE.html
echo "<br />"  >> ERROR_FILE.html
echo "<br />"  >> ERROR_FILE.html

when I am executing this the
Code:
bgcolor

is missing and i am not able to get color of it

Code:
<html>
<Body>
<table border=1>
<tr>
<TD colspan=0 bgcolor=>
Fetching Data capture customer2 </TD>
<TD>http://abc:1234/cbcm</TD>
</tr>
<tr>
<TD colspan=0 bgcolor=>
Click on Subrequest number </TD>
<TD>http://au479:7003/cbcm</TD>
</tr>
</table>
</Body>
</html>
<br />
<br />


Last edited by mirwasim; 08-04-2016 at 05:16 AM..
# 2  
Old 08-04-2016
Hello mirwasim,

You should make some changes into your html file.
i- First of all please complete the chain of <html> tag, means when you are done with writing html file your last tag should be </html>.
ii- Change capital <TD> to small <td> and </TD> to </td>.
iii- Make a function of sendmailwhere you should mention about you data's type as html as follows is an example. Let's say you html file name is Input_file.html.
Code:
MAILTO=chumma@chumma.com
sendmail_touser() {
cat - Input_file.html <<EOF | /usr/sbin/sendmail -oi -t
From: ${MAILFROM}
To: ${MAILTO}
Subject: $1
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
EOF
}
sendmail_touser "This is test"

Off course you should make changes into your awk command to generate the html file which you could try with all above mentioned points and let us know then.

Thanks,
R. Singh
# 3  
Old 08-04-2016
awk is treating #DC143C as the start of a comment and does not execute the remainder of the line.
These 2 Users Gave Thanks to RudiC For This Post:
# 4  
Old 08-04-2016
Quote:
Originally Posted by RavinderSingh13
Hello mirwasim,

You should make some changes into your html file.
i- First of all please complete the chain of <html> tag, means when you are done with writing html file your last tag should be </html>.
ii- Change capital <TD> to small <td> and </TD> to </td>.
iii- Make a function of sendmailwhere you should mention about you data's type as html as follows is an example. Let's say you html file name is Input_file.html.
Code:
MAILTO=chumma@chumma.com
sendmail_touser() {
cat - Input_file.html <<EOF | /usr/sbin/sendmail -oi -t
From: ${MAILFROM}
To: ${MAILTO}
Subject: $1
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
EOF
}
sendmail_touser "This is test"

Off course you should make changes into your awk command to generate the html file which you could try with all above mentioned points and let us know then.

Thanks,
R. Singh

Thanks for your reply.
Ii see
Code:
html

is closed and i have make
Code:
td

also
but you see the output i am getting, if you put it in notepad and open as
Code:
.html

you will not see result
i need to know if i am putting color code in wrong format in my
Code:
nawk print

command

---------- Post updated at 01:50 PM ---------- Previous update was at 01:49 PM ----------

Quote:
Originally Posted by RudiC
awk is treating #DC143C as the start of a comment and does not execute the remainder of the line.
how can i get rid of this and i want to print red color for both the columns
# 5  
Old 08-04-2016
Remove the double quotes around the colour code.
This User Gave Thanks to RudiC For This Post:
# 6  
Old 08-04-2016
Quote:
Originally Posted by RudiC
Remove the double quotes around the colour code.
it worked BroSmilie..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Error in excuting while loop

can you please support me to understand what is wrong in this code, I am getting error as sytnax error near unexpected token if if then code is cat text.txt | /path/mapper.sh data in file is hi hi how how are you while read line do for word in $line do if then wcount=`echo... (4 Replies)
Discussion started by: mirwasim
4 Replies

2. UNIX for Dummies Questions & Answers

Crontab jobs excuting

Hi i want to run the cronjob from 7 Am till 11.30Am for every 5 minutes from monday to friday. can anyone help? (15 Replies)
Discussion started by: satheesh_charle
15 Replies

3. Programming

How to make C++ give me a chance to inter a number while excuting?

Iam Trying to simulate a hardware "pci" by visual c++ program..... " i don't have the hardware right now so i want to test my program" the hardware is about to inter a number for example from switches compare it to other number also from switches.."which iam gonna take it from 1 textbox"... 1-... (0 Replies)
Discussion started by: fwrlfo
0 Replies

4. Shell Programming and Scripting

excuting the following code

hi i am trying the below code for the following |_ | |_ | |_ |_ | |_ |_ |_ | |_ |_ |_ |_ and for this code also * * * * * * * * * * * * * * * !/bin/bash #i = "*" (2 Replies)
Discussion started by: kullu
2 Replies

5. Shell Programming and Scripting

Problem in excuting my First Shell Script

Hi i am a newbie to unix /Linux .Please help I have a following script which says that there is a syntax error :( My program is echo Enter two Numbers read a b if echo First is greater else echo Second is greater fi (3 Replies)
Discussion started by: Ravi Pavanv
3 Replies

6. UNIX for Advanced & Expert Users

html parsing using unix

hi all, I had raised the same question a few weeks back but forgot to mention a lot of points ... so i am raising a new thread furnishing my requirement ... sorry for that .... here is my problem. i have a html that look like below <tr class="modifications-oddrow"> <td... (2 Replies)
Discussion started by: sais
2 Replies

7. AIX

crontab isn't excuting some commands

Greetings everybody, I have an IBM P520 AIX 5.3 server machine and trying to use crontab to periodically excute a script that contains a command belongs to my software (Fast/Tools SCADA software) I added the following line after using crontab -e 01 * * * * /mypath/myscript I have two... (3 Replies)
Discussion started by: ayman metwally
3 Replies

8. Shell Programming and Scripting

Excuting UNIX Functions under several username and host

Hi, I am facing a issue in one of my script, Please help me on the same. Below I have the example. Example: I have two functions(host(),user()) in a single file named test1.ksh File Name: test1.ksh host () { HOST=`hostname` echo... (1 Reply)
Discussion started by: samvino
1 Replies

9. UNIX for Dummies Questions & Answers

Excuting Multiple shell files in sequesnce

Hi, I have two shell scripts each executing a java process independently. These are two independent processes and I need to sequence them using another shell script. What I did was created another shell script and called these independent shell scripts in it. It runs fine, however from time... (3 Replies)
Discussion started by: gupta_arunesh
3 Replies

10. UNIX for Dummies Questions & Answers

HTML-CGI on Unix

AAAHHH!! I've made a perl program that you can run on a web browser. This program needs to be run everyday, and I don't want to have to run it everyday. The problem is when I try running the program from my terminal, all it does is print stuff to the terminal page (the program involves a lot of... (4 Replies)
Discussion started by: sstevens
4 Replies
Login or Register to Ask a Question