On 21.11.2011 21:51, yesitsjess wrote:> 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";
> }
> }
This is not R code. Please note you wrote to the *R*-help list!
Uwe Ligges
> --
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.