0
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.

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by mitchems
0

Have you tried loading the entire file into a variable for searching? You can do this by:

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

Then run a multi-line regex on the vairable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.