LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   ... (https://www.linuxquestions.org/questions/programming-9/a-4175529006/)

son.lun 12-22-2014 08:06 AM

...
 
...

pan64 12-22-2014 09:30 AM

please open a new thread, do not continue posting into old threads....

pan64 12-22-2014 09:36 AM

the perl script you posted does something else, it does not work on paragraphs but count words.
How do you want to identify paragraphs?

son.lun 12-22-2014 10:56 AM

...

pan64 12-22-2014 12:12 PM

do you think something like this:
Code:

#!/usr/bin/perl -w
use strict;

open F, "/tmp/pubmedresults.txt" or die $!;

my $l;
while (defined ($l = <F>)) {
    my ($a, $b) = ($l =~ /^([^- ]+)\s*-\s*(.*)/);
    next if ! defined $a;
    if ( $a eq "PMID" ) {
        print "$b\n";
        open O, ">$b";
    }
    if ( $a eq "AB" ) {
        print O "$b\n";
        while (<F>) {
          last if ( /^\w/ );
          print O;
      }
      printf O "\n";
      close O;
    }
}


son.lun 12-22-2014 04:10 PM

...

son.lun 12-22-2014 04:20 PM

...

son.lun 12-22-2014 05:47 PM

....

NevemTeve 12-22-2014 11:35 PM

(I suggest you ask your next question with a different nickname.)

dugan 12-23-2014 03:42 AM

Just so you know, son.lun. "Do not destroy content" (including your own) is one of the unwritten rules here. I have seen people banned for it, and I recommend that you restore your posts.


All times are GMT -5. The time now is 08:51 AM.