The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To Break data out of HTML phip Shell Programming and Scripting 1 05-20-2008 03:23 AM
extract data from html tables Streetrcr UNIX for Dummies Questions & Answers 8 03-20-2008 06:14 AM
Converting Shell Script to HTML davwel Shell Programming and Scripting 3 10-25-2007 10:25 PM
Converting HTML to CSV Jexel UNIX for Dummies Questions & Answers 3 03-18-2007 08:44 PM
Converting %## back to special characters from an HTML form 98_1LE Shell Programming and Scripting 1 01-14-2006 11:30 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 04-21-2008
garric garric is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 99
Converting HTML data into a spreadsheet

Hi,

I have a perl script that prints some data in the form of a table (HTML table) Now, I want to be able to convert this data into a report on an Excel sheet. How can I do this?

Regards,
Garric
  #2 (permalink)  
Old 04-21-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Modding the script is probably less frustrating than parsing HTML tables.

Tab-delimited or comma-delimited should be fine for any spreadsheet.

(I wouldn't be surprised if Excel and/or OOo had limited support for directly importing HTML tables these days, either.)
  #3 (permalink)  
Old 04-22-2008
garric garric is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 99
Thanks, a comma seperated list wont be a problem. Any idea how I can add the 'file creation box' (the one that pops up when we try creating a new file on wondows) on the html web page? Can you help?
  #4 (permalink)  
Old 04-22-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
if you are planning to create a fancy excel sheet, then Spreadsheet::WriteExcel will help you
  #5 (permalink)  
Old 04-22-2008
koti_rama koti_rama is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 50
Try this awk

awk 'BEGIN{
FS="|"
print "<HTML><BODY><TABLE border=1>"
}
{

printf "<TR>"
if(i=1)
printf "<TD ALIGN=\"LEFT\" width=\"100\" height=\"25\"><font size=\"2\" face=\"Verdana\"><b>%s</font></b></TD>", $i
if(i=2)
printf "<TD ALIGN=\"LEFT\" width=\"300\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
if(i=3)
printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
if(i=4)
printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
if(i=5)
printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
if(i=6)
printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
}
END{
print "</TABLE></BODY></HTML>"
}
' file.txt >> file1.xls


****** i-- has number of records
******delimiter is " |"


it's return XLS files and open in windows.
Sponsored Links
Closed Thread

Bookmarks

Tags
html, perl

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0