Help in using html in Shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help in using html in Shell script
# 1  
Old 03-26-2015
Help in using html in Shell script

Hi,

I made a script that displays various fileds of report that are required in csv format and send it on mail(the csv file). Now I want to convert the csv format into html table and then send it on mail.


Reports_Output.csv


Code:
Code:
STREAM,INF,INREC,DUP_FILES,REJ_FILES,GAP,OLD,DISCARDED
mmsc,288,667901,183419,0,0,0,0
psoc,70,1059046,3176928,0,0,1,0
gsmo,192,573928,1727265,7131,0,0,0
roam,1807,257018,681672,35,0,1746,0


I want to display it in table format-(as example)

Code:
STREAMINFINRECmmsc288667901psoc701059046



I searched in the forum that could give me this kind of output but no luck.

Please help me.

Last edited by Scrutinizer; 03-26-2015 at 11:08 AM.. Reason: CODE tags
# 2  
Old 03-26-2015
Try:
Code:
awk '{print $1 $2 $3} END{print RS}' FS=, ORS=

# 3  
Old 03-26-2015
What happened to lines 4 and 5 in your input file? Which condition rules them out? And - your sample doesn't really look a table. How about making up your mind on what you really need?
# 4  
Old 03-27-2015
Code:
STREAM  INF   INREC    DUP_FILES
mmsc     288   667901   183419
psoc       70    1059046  3176928

It should display like this and so on with Table border.

Last edited by Scrutinizer; 03-27-2015 at 05:16 AM.. Reason: code tags
# 5  
Old 03-27-2015
You might want to peek into https://www.unix.com/302938396-post17.html
# 6  
Old 03-27-2015
Thanks a lot. It worked.
I also want to format and fill colours in the table. Could you please help me.
# 7  
Old 03-27-2015
Quote:
Originally Posted by Supriya Singh
Code:
STREAM  INF   INREC    DUP_FILES
mmsc     288   667901   183419
psoc       70    1059046  3176928

It should display like this and so on with Table border.

Code:
try using the below sample script

$ cat outtohtml.sh
file=$1
`awk -F , ' BEGIN { print "<table border=1>"} \
NR == 1 { print "<th>";for(i=1;i<=NF;i++)print "<td><FONT COLOR=BLUE FACE="Geneva,Arial" SIZE=6>"$i"</FONT></td>";\
print "</th>" }\
NR > 1 {print "<tr>"; for(i=1;i<=NF;i++)print "<td><FONT COLOR=BLUE FACE="Geneva,Arial" SIZE=6>"$i"</FONT></td>";\
print "</tr>"} END { print "</table>" }' $file > $file.html`

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script Shell how's converting .html files

Hello everybody, :) I need some help with a school project that I have to create for the next week. :eek: So first, the aim of the Script is that I have a WebSite with a lot of .html / .shtml / .js / .css in one directory. That directory have few directory too but that's not so important,... (1 Reply)
Discussion started by: mariocrocop
1 Replies

2. Shell Programming and Scripting

Using HTML inside shell script

Hi, Am trying to use HTML tags inside my script but its not printing the required output. Any idea how to use html inside script will be helpful. #!/bin/ksh echo '<html>' echo '<font face='Calibri' size='3'> JobName Status</font>' echo '</html>' Output<html> <font ... (6 Replies)
Discussion started by: rogerben
6 Replies

3. Shell Programming and Scripting

Migrating from Shell Script to HTML Page

Hi, Need Help, Recently I have thought to migrating my Korn Shell Scripts to html page..., already webserv is running on my unix machine. How to migrate the shell scripts to html page.. Please refer any web portal or sample codes. Thanks in Adavce (2 Replies)
Discussion started by: l_gshankar24
2 Replies

4. Shell Programming and Scripting

SHELL SCRIPT AND HTML

Hello I'm trying to develop a shell script that executes commands such as cat / etc / fstab uname, etc. ..... which generates me an output file format html own way. Currently the shell script with the commands there, I have some notions of html but the generation of my html file is not clean at... (2 Replies)
Discussion started by: ddtseb
2 Replies

5. Shell Programming and Scripting

Return to HTML file from shell script

Hi! I'm writing a simple script which I call on using a simple html button. The script also recives a simple argument. After the script is done I immediately want to return to my html page. But I dont know how to do that! #!/bin/sh echo "Content-type: text/html" echo "" if then echo... (1 Reply)
Discussion started by: crille
1 Replies

6. Shell Programming and Scripting

How can I execute a shell script from an html link?

I want to execute a shell script when clicking on an html link. I want the output of the script to be shown on the webpage. Whats the best way to achieve this? (6 Replies)
Discussion started by: streetfighter2
6 Replies

7. UNIX for Advanced & Expert Users

shell script to parse html file

hi all, i have a html file something similar to this. <tr class="evenrow"> <td class="data">added</td><td class="data">xyz@abc.com</td> <td class="data">filename.sql</td><td class="modifications-data">08/25/2009 07:58:40</td><td class="data">Added TK prof script</td> </tr> <tr... (1 Reply)
Discussion started by: sais
1 Replies

8. Shell Programming and Scripting

have a shell script done in pl/sql and want output in html

I have this shell script where I have both pl/sql and sql. But want to have a snigle output file where the result of each cursors are in HTML tables. I was able to do that on my old script but it was only sql scripts (no pl/sql). Can I do have such outputs now with my new script where I... (2 Replies)
Discussion started by: arobert
2 Replies

9. UNIX for Dummies Questions & Answers

Unix Shell Script along with .HTML

Hi, I need to know how to interact the unix shell script along with a .html. For example, I have a code like: #! /bin/sh exit_err() { print "Content-type: text/html\n" print $1 exit } toolbin/gu -i -r 'm_who(user,group,role,name,addr,phone)' > /tmp/temp.txt... (3 Replies)
Discussion started by: ronix007
3 Replies

10. Shell Programming and Scripting

Converting Shell Script to HTML

Hi, Im new to shell scripting. My task is to convert shell script feed into html, so basically I have a lot of information in shell script and I want to convert it html. I know you can simply convert the information by hand, but is there any simpler way? Thank you Dave (3 Replies)
Discussion started by: davwel
3 Replies
Login or Register to Ask a Question