convert csv to html file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers convert csv to html file
# 1  
Old 09-09-2009
convert csv to html file

Hi All,

I am new to this forum,not sure where to post this query...so posted here
Kindly need any of your help on the below
------------
I am using shell scripting and trying to convert a csv file to html file...
example.csv
---------------
Name Country Age Sex
Andy India 25 Female
Sandy Australia 23 Male
Aruni UK 24 Male
Pavni India 20 Female
--------------
Pls. tell me how to convert this csv file example.csv to html file
# 2  
Old 09-09-2009
Hi Sumithra,

In our organization for converting a csv file to html file we are using the help of "csv2html" software which do the conversion .
Regards,
Sanjay

Last edited by sanjay.login; 09-09-2009 at 06:00 PM..
# 3  
Old 09-10-2009
Hi sanjay,
Thanks for the reply...but i dont want to use any software...isn't it possible with of any software.
Could any one please provide me the code for the same.
rds,
Sumithra
# 4  
Old 09-10-2009
Sumithra,
coluld you please send the format of your csv file is it "," delimited or........
# 5  
Old 09-12-2009
CPU & Memory Are you trying to create a html table from the CSV file?

This should help if that is what you need

Code:
nawk 'BEGIN{
FS=","
print  "MIME-Version: 1.0"
print  "Content-Type: text/html"
print  "Content-Disposition: inline"
print  "<HTML>""<TABLE border="1"><TH>Heading1</TH><TH>Heading2</TH><TH>Heading3</TH>" 
}
 {
printf "<TR>"
for(i=1;i<=NF;i++)
printf "<TD>%s</TD>", $i
print "</TR>"
 }
END{
print "</TABLE></BODY></HTML>"
 }
' file-to-convert.csv > file.html

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert content of file to HTML

Hi I have file like this: jack black 104 daniel nick 75 lily harm 2 albert 5 and need to convert it into the html table like this: NO.......name....family..... id 1...........jack.....black.....104 2..........daniel....nick.......75 3..........albert.................5 i mean... (5 Replies)
Discussion started by: indeed_1
5 Replies

2. Shell Programming and Scripting

Convert csv data to html format

I am new to html and need to convert the attached csv file data to html format ; running into issues. please assist. #!/bin/ksh echo "<html>" ; echo "<head><style> table {border-collapse: collapse;} table, td, th {border: 1px solid black;} </style></head>" echo "<title> REPORT </title>" echo... (0 Replies)
Discussion started by: archana25
0 Replies

3. 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

4. Shell Programming and Scripting

Script to convert csv file to html with good visibility

Hi, I have Below script which converts csv file to html succesfully.but the visiblity is simple in black n white. I want to have better visibilty of each columns in different colours(like green).As it is a Database report suppose some tablespace available space is less than 20% then it should... (7 Replies)
Discussion started by: sv0081493
7 Replies

5. Shell Programming and Scripting

Script to convert CSV file to HTML

Hi, I have made a a script which creates a csv file as daily database report However i want to covert that csv file to html because csv file does not have a good visibilty. So it is possible to have such csv to html coversion script. Your prompt help much appreciated. Thanks in advance (4 Replies)
Discussion started by: sv0081493
4 Replies

6. Shell Programming and Scripting

Awk script to convert csv to html

Hi Written some script to convert csv to html but could not add table headers.Below are the errors iam getting ./csv2html | more + awk -v border=1 -v width=10 -v bgcolor=black -v fgcolor=white BEGIN { printf("<table border=\"%d\" bordercolor=\"%s\" width=\"%d\"... (2 Replies)
Discussion started by: zeebala1981
2 Replies

7. Shell Programming and Scripting

Is it possible to convert text file to html table using perl

Hi, I have a text file say file1 having data like ABC c:/hm/new1 Dir DEF d:/ner/d sd ...... So i want to make a table from this text file, is it possible to do it using perl. Thanks in advance Sarbjit (1 Reply)
Discussion started by: sarbjit
1 Replies

8. Shell Programming and Scripting

how to convert a html file to an .xml one

Hii every one. I have lots of .html files like: <html> <title> </title> <head> </head> <body> <ul id="SummaryRatings">4 stars </ul> <ul id="summaryList"> <p><b> Aurhor</b> </p> <p>wsfwfrfrtgretryetyrtyty</p> </ul> ...... ....... </body> </html> (6 Replies)
Discussion started by: kheyali Mitra
6 Replies

9. Shell Programming and Scripting

Need help to convert Flat file to HTML

Hello I need help to convert flat file data to HTML Table format. I am generating everyday Flat file and want to convert into HTML Table format. The format of my file is: version host Total YRS NO APPS PSD 10 Sun 30 2 4 6 7 and flat... (11 Replies)
Discussion started by: getdpg
11 Replies
Login or Register to Ask a Question