Brian,
I assume all the input file data is placed into $filebuf;
----------------------------------------------------------------------------
---------------------
$filebuf =~ s{<Filename (\d+_\d+.sgml>)(.*?)(?=<Filename \d+_\d+.sgml>)}
{
my ($filename,$filedata)=($1,$2);
file_write($filename, $filedata);
}exgs;
sub file_write($$)
{
my($filepath,$filebuf) = @_;
chomp($filepath);
open(FOUT,"> $filepath") || die "Unable to open file : $filepath";
print FOUT $filebuf;
close(FOUT);
}
----------------------------------------------------------------------------
---------------------
I haven't tested the code but I hope you have got the logic behind it.....:)
Thanks & Regards,
Sandeep Deshpande
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Brian
Widman
Sent: Tuesday, June 07, 2005 12:24 AM
To: [email protected]
Subject: [Perl-unix-users] [Fwd: Breaking 1 file into many little ones]
Hi all,
I hope somebody will be able to help me with the following problem. I
have one large file that contains many sgml tags. I would like to break
this file into many little ones with a name based on the an sgml tag
which is also the first line in each little sgml body.
ex.
<Filename 000001_1.sgml>
<blah
...
</body>
<Filename 000002_1.sgm>
....
</body>
....
--
Brian
_______________________________________________
Perl-Unix-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Unix-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs