Sponsored Content
Full Discussion: convert csv to html file
Top Forums UNIX for Dummies Questions & Answers convert csv to html file Post 302352583 by pgop on Saturday 12th of September 2009 04:45:38 AM
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

 

9 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

9. 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
Email::MIME::ContentType(3pm)				User Contributed Perl Documentation			     Email::MIME::ContentType(3pm)

NAME
Email::MIME::ContentType - Parse a MIME Content-Type Header VERSION
version 1.013 $Id: /my/pep/Email-MIME-ContentType/trunk/lib/Email/MIME/ContentType.pm 31133 2007-03-22T19:52:26.296283Z rjbs $ SYNOPSIS
use Email::MIME::ContentType; # Content-Type: text/plain; charset="us-ascii"; format=flowed my $ct = 'text/plain; charset="us-ascii"; format=flowed'; my $data = parse_content_type($ct); $data = { discrete => "text", composite => "plain", attributes => { charset => "us-ascii", format => "flowed" } }; FUNCTIONS
parse_content_type This routine is exported by default. This routine parses email content type headers according to section 5.1 of RFC 2045. It returns a hash as above, with entries for the dis- crete type, the composite type, and a hash of attributes. WARNINGS
This is not a valid content-type header, according to both RFC 1521 and RFC 2045: Content-Type: type/subtype; If a semicolon appears, a parameter must. "parse_content_type" will carp if it encounters a header of this type, but you can suppress this by setting $Email::MIME::ContentType::STRICT_PARAMS to a false value. Please consider localizing this assignment! PERL EMAIL PROJECT
This module is maintained by the Perl Email Project. <http://emailproject.perl.org/wiki/Email::MIME::ContentType> AUTHOR
Casey West, "casey@geeknest.com" Simon Cozens, "simon@cpan.org" SEE ALSO
Email::MIME perl v5.8.8 2008-03-01 Email::MIME::ContentType(3pm)
All times are GMT -4. The time now is 04:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy