Front page | perl.beginners |
Postings from March 2002
RE: finding text
Thread Previous
|
Thread Next
From:
Michael Gargiullo
Date:
March 27, 2002 21:58
Subject:
RE: finding text
Message ID:
NGBBJEADBDIGMPLAMOCNAEAFCCAA.gargiullo@comcast.net
The actual html (Which I jst grabbed) is :
<table border=0 cellspacing=4 cellpadding=1 width="45%">
<td align=center><FONT SIZE=+1>Data source: <A
HREF="../products/z5/z5.htm">ZIPList5</A> (March 2002)
</FONT></td></table></CENTER><BR>
<center><table border=0 cellspacing=4 cellpadding=1>
<tr><th>Mailing<BR>Name</th><th>State<BR>Code</th><th>ZIP<BR>Code</th><th>Co
unty<BR>Name</th><th>FIPS<BR>Code</th></tr><tr><td
align=center>Hightstown</font></td><td align=center>NJ</font></td><td
align=center>08520</font></td><td align=center>Mercer</font></td><td
align=center>34021</font></td></tr></table>
Thats a section that contains what I want. The actual page is much larger.
What I'm trying to extract is this:
Hightstown
NJ
08520
Mercer
This is always before the <TR> I want:
<tr><th>Mailing<BR>Name</th><th>State<BR>Code</th><th>ZIP<BR>Code</th><th>Co
unty<BR>Name</th><th>FIPS<BR>Code</th></tr>
-----Original Message-----
From: bob ackerman [mailto:rdacker@pacbell.net]
Sent: Thursday, March 28, 2002 12:48 AM
To: beginners@perl.org
Subject: Re: finding text
how do you mean to identify the row you want to capture?
or are you saying you have the row and just want to know how to parse the
line to get text between <td> and </td>?
On Wednesday, March 27, 2002, at 09:41 PM, Michael Gargiullo wrote:
> I use LWP::Simple to get an HTML page. I only want to keep one table row,
> and then only the data from the row in seperate fields.
>
> For example:
>
> <html>
> <head>
> <title>page 1</title>
> </head>
> <body>
> <table><tr><td>some text</td></tr><tr><td>a few links</td></tr></table>
> <table>
> <tr><td>some text</td><td>some text</td></tr>
> <tr><td>some text</td><td>a few links</td></tr>
> <tr><td> THE DATA I WANT</td><td> MORE DATA I WANT</td>
> </table>
>
> I want to be able to set vars to each of the data pieces on the page I
> want
> to keep.
>
> i know i should do some pattern matching of some sort, but need some sort
> of
> kick start. This is my first attempt at writting a perl script to parse
> through text.
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
>
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
Thread Previous
|
Thread Next