Re: Extracting one record from multiple-records textfile

2007-11-28 Thread John W . Krahn
On Wednesday 28 November 2007 14:05, Giuseppe.G. wrote: > > On 28 Nov, 01:44, [EMAIL PROTECTED] (Jeff Pang) wrote: > > > > Just show another way to do it. > > > > use strict; > > > > local $/="\n\n"; > > while() { > > next unless /^DOC-START\n(.*?)\nDOC-END$/sm; > > my $content = $1; > >

Re: Extracting one record from multiple-records textfile

2007-11-28 Thread Giuseppe.G.
On 28 Nov, 01:44, [EMAIL PROTECTED] (Jeff Pang) wrote: > Hello, > > Just show another way to do it. > > use strict; > > local $/="\n\n"; > while() { > next unless /^DOC-START\n(.*?)\nDOC-END$/sm; > my $content = $1; > parse($content); > > } Thank you all for your answers. In particula

Re: Extracting one record from multiple-records textfile

2007-11-27 Thread John W . Krahn
On Tuesday 27 November 2007 11:29, Giuseppe.G. wrote: > Hello there. Hello, > I'm a real beginner and I was wondering if you could be > so kind to help me on this. > I have a text file, containing a number of varying length documents, > all tagged with DOC-START and DOC-END, structured as follows

Re: Extracting one record from multiple-records textfile

2007-11-27 Thread Jeff Pang
Hello, Just show another way to do it. use strict; local $/="\n\n"; while() { next unless /^DOC-START\n(.*?)\nDOC-END$/sm; my $content = $1; parse($content); } sub parse { my $c = shift; print length($c),"\n"; } __DATA__ DOC-START content of the document DOC-END DOC-START

Re: Extracting one record from multiple-records textfile

2007-11-27 Thread Tom Phoenix
On 11/27/07, Giuseppe.G. <[EMAIL PROTECTED]> wrote: > I have a text file, containing a number of varying length documents, > all tagged with DOC-START and DOC-END, structured as follows: > > > DOC-START > content of the document > DOC-END > I need to take every document and pass it to a parsing f

Extracting one record from multiple-records textfile

2007-11-27 Thread Giuseppe.G.
Hello there. I'm a real beginner and I was wondering if you could be so kind to help me on this. I have a text file, containing a number of varying length documents, all tagged with DOC-START and DOC-END, structured as follows: DOC-START content of the document DOC-END DOC-START some text DOC-EN