seeking help

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2009
Posts: 8
Reputation: rayken1 is an unknown quantity at this point 
Solved Threads: 0
rayken1 rayken1 is offline Offline
Newbie Poster

seeking help

 
0
  #1
Aug 3rd, 2009
use warnings;
use strict;

open (TEXT_FILE,'C:\Documents and Settings\rnjenga\sawa3.txt');


my ($line, $nextline);
while ($line = <TEXT_FILE>) {


if ($line =~ /FT\s*\Wnote.+\w+:/){
$nextline = <TEXT_FILE> ;
print ("$line $nextline \n");
}

if ($line =~ /FT\s*\Wnote.+none/){
$nextline = <TEXT_FILE> ;
print ("$line $nextline \n");
}

}
close (TEXT_FILE);

I have written the above code to be able to pull the following results out of the text file.

FT /note="go_function: nutrient reservoir activity [goid
FT 0045735]"


FT /note="none"

Now I need you help to be able to write a code that will copy the BOLD string onto the second one.
I have tried too see if I can be able to skip it during reading the file but to no avail.
Kindly assist.

Thanks and God Bless.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: mitchems is an unknown quantity at this point 
Solved Threads: 2
mitchems's Avatar
mitchems mitchems is offline Offline
Junior Poster in Training

Re: seeking help

 
0
  #2
Aug 3rd, 2009
Have you tried loading the entire file into a variable for searching? You can do this by:

  1. undef($/);
  2. open(FILE,"<file.txt");
  3. while(<FILE>){
  4. $allfile=$_;
  5. }

Then run a multi-line regex on the vairable.
And don't tell me there isn't one bit of difference between null and space, because that's exactly how much difference there is.

Larry Wall
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Perl Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC