![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| PHP: Sorting HTML table | pondlife | Shell Programming and Scripting | 1 | 02-04-2008 06:55 AM |
| Export a HTML table to Xcel | garric | Shell Programming and Scripting | 3 | 02-01-2008 05:46 AM |
| How do I extract text only from html file without HTML tag | los111 | UNIX for Dummies Questions & Answers | 4 | 11-28-2007 04:40 AM |
| HELP with using a lookup table | Dolph | UNIX for Dummies Questions & Answers | 6 | 03-27-2007 04:26 AM |
| table | howeezy | High Level Programming | 1 | 09-23-2005 02:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
HTML table to CSV
Hi !!
I have HTML Tables through which i want to generate graphs, but for creating graphs i need the file in CSV format so can anyone can please help me in how can i convert my HTML table file to CSV format. Thanks in Advance |
|
|||||
|
Hi.
If you have command lynx (a text-mode browser) installed, it does a good job of removing markup tags: Code:
% cat s1
#!/usr/bin/env sh
# @(#) s1 Demonstrate lynx -dump to eliminate html tags.
set -o nounset
echo
debug=":"
debug="echo"
## Use local command version for the commands in this demonstration.
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version bash lynx sed tr
echo
FILE=${1-data1.html}
echo " Input data:"
cat $FILE
echo
echo " Final results:"
lynx -dump $FILE |
tee t1 |
sed -e 's/^ *//' |
tr -s ' ' ','
echo
echo " Intermediate results from lynx:"
cat t1
exit 0
Code:
% ./s1 (Versions displayed with local utility "version") GNU bash 2.05b.0 Lynx Version 2.8.5rel.1 (04 Feb 2004) GNU sed version 4.1.2 tr (coreutils) 5.2.1 Input data: <HTML> <HEAD> <TITLE>Table with numeric data</TITLE> </HEAD> <BODY> <TABLE border="1"> <TR> <TD>5</TD> <TD>4</TD> <TD>23</TD> </TR> <TR> <TD>10</TD> <TD>3</TD> <TD>24</TD> </TR> <TR> <TD>6</TD> <TD>12</TD> <TD>28</TD> </TR> <TR> <TD>17</TD> <TD>20</TD> <TD>32</TD> </TR> </TABLE> </BODY> </HTML> Final results: 5,4,23 10,3,24 6,12,28 17,20,32 Intermediate results from lynx: 5 4 23 10 3 24 6 12 28 17 20 32 |
![]() |
| Bookmarks |
| Tags |
| csv, perl, perl script, perl shift, shift, shift perl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|