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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.