In each of 5,000 HTML files I have to get only one line of text, which is line 999. How can I tell the HTML::Parser that I only have to get line 999?
</p><h1>dataset 1:</h1>
<table border="0" bgcolor="#EFEFEF" leftmargin="15" topmargin="5"><tr>
<td><strong>name:</strong> </td> <td width=500> myname one </td></tr><tr>
<td><strong>type:</strong> </td> <td width=500> type_one (04313488) </td></tr><tr>
<td><strong>aresss:</strong> </td><td>Friedrichstr. 70, 73430 Madrid</td></tr><tr>
<td><strong>adresse_two:</strong> </td> <td> no_value </td></tr><tr>
<td><strong>telefone:</strong> </td> <td> 0000736111/680040 </td></tr><tr>
<td><strong>Fax:</strong> </td> <td> 0000736111/680040 </td></tr><tr>
<td><strong>E-Mail:</strong> </td> <td> Keine Angabe </td></tr><tr>
<td><strong>Internet:</strong> </td><td><a href="http://www.mysite.es" target="_blank">www.mysite.es</a><br></td></tr><tr> <td><strong>the office:</strong> </td>
<td><a href="http://www.mysite_two" target="_blank">mysite_two </a><br></td></tr><tr>
<td><strong>:</strong> </td><td> no_value </td></tr><tr>
<td><strong>officer:</strong> </td> <td> no_value </td> </td></tr><tr>
<td><strong>employees:</strong> </td> <td> 259 </td></tr><tr>
<td><strong>offices:</strong> </td> <td> 8 </td></tr><tr>
<td><strong>worker:</strong> </td> <td> no_value </td></tr><tr>
<td><strong>country:</strong> </td> <td> contryname </td></tr><tr>
<td><strong>the_council:</strong> </td> <td>
Well, the question is, is it possible to do the search in the 5000 files with this attribute: That the line 999 is of interest. In other words, can I tell the HTML-parser that it has to look (and extract) exactly line 999?
Hello dear RedGritty Brick - i have little experience with HTML :: TokeParser
use HTML::TreeBuilder::XPath;
my $tree = HTML::TreeBuilder::XPath->new;
#use real file name here
open(my $fh, "<", "file.html") or die $!;
$tree->parse_file($fh);
my ($name) = $tree->findnodes(qq{/html/body/table/tr[1]/td[2]});
print $name->as_text;
BTW; RedGrittyBrick: See one of the example sites: http://www.kultusportal-bw.de/servlet/PB/menu/1188427/index.html?COMPLETEHREF=http://www.kultus-bw.de/did_abfrage/detail.php?id=04313488 in the grey shadowed block you see the wanted information: 17 lines that are wanted. Note - i have 5000 different HTML-files - that all are structured in the very same way!
That means i would be happy to have a template that can be runned with HTML::TokeParser::Simple and DBI.
love to get hints