Jose Bento wrote at Sun, 28 Jul 2002 01:10:19 +0200:

> I have a text file (*.doc) that have a list of articles all of them separated by the 
>some sequence
> of characters (NNNN).
> 
> How can I divide this file into several files each one with only one article?
 
What have you tried so far ?
Why is it a cgi - question -
from my point of view it's misposted and should be better and perl.beginners.

If the files aren't too big,
a simple solution could be:

open FILE, "xyz.doc" or die " ... ";
my $text     = join "", (<FILE>);
close FILE;

my @article = split /NNNN/, $text;

foreach my $nr (0 .. $#article) {
    open FILE, ">arcticle_$nr.doc" or die " ... ";
    print FILE $article[$nr];
    close FILE;
}

[untested]


Best Wishes,
Janek


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to