[R] Read from HTML file, print if see a specific string

yesitsjess grumpygrim at msn.com
Mon Nov 21 21:51:20 CET 2011


So basically I have made a HTML file with a table in it. 

Column 3 contains a GenBank number and is always proceeded by "=GenBank">". 

I want to read the file and return the number which comes directly after
this (the contents of column 3).

Ideally I would like to save this number as a string for use later in the
script, but any help is good help. Been at this for HOURS and HOURS and
HOURS.

This is what I have so far:

#Open html file
$filename1 = 'Result1.html';
open (FILE1, $filename1) or die "Can't open $filename1 $!";
#Create array of results file data
@html1 = <FILE1>;
close (FILE1);
#What to look for
$genbank='^=GenBank">\$';

foreach $html1(@html1)
        {
                if (index($html1,$genbank) ge 0)
                {
                        print "Number here!\n";
                }
        }

--
View this message in context: http://r.789695.n4.nabble.com/Read-from-HTML-file-print-if-see-a-specific-string-tp4093273p4093273.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list