Range Parsing Issue 
Author Message
 Range Parsing Issue

This might be a pretty basic question but a solution didn't jump out at me from my Camel
or Llama book; either my brains failing or I need to stop being a part-time Perl'r.

I have a text file which contains about 100 records.  These text records are identified
by a header line which matches:


I would like parse out the data from the beginning of a specific article up to the
beginning of the next article.  The only info I have is the number of the desired
article, but not that of the following.  So I might want article 12345678 (beginning

$article_id=12345678;
while(<INFILE>) {


        print;
        }}}

It starts and terminates on the first line which matches.  Is there some way to make the

any help on this matter.  Much thanks in advance.

Coburn Watson
Systems/DB Admin.

p.s. I was able to perform this in awk setting FS and RS accordingly, but the record
text is two long for awk/nawk and they choke.



Tue, 22 Feb 2000 03:00:00 GMT  
 Range Parsing Issue

[posted & mailed]

Quote:

> This might be a pretty basic question but a solution didn't jump out at me from my Camel
> or Llama book; either my brains failing or I need to stop being a part-time Perl'r.

> I have a text file which contains about 100 records.  These text records are identified
> by a header line which matches:


> I would like parse out the data from the beginning of a specific article up to the
> beginning of the next article.  The only info I have is the number of the desired
> article, but not that of the following.  So I might want article 12345678 (beginning

> $article_id=12345678;
> while(<INFILE>) {


>         print;
>         }}}

> It starts and terminates on the first line which matches.  Is there some way to make the

> any help on this matter.  Much thanks in advance.

I think what you want to do is this:

while (<INFILE>) {

    $in_article = ($1 == $article_id);
  }
  print if $in_article;

Quote:
}

Hope this helps,

Benjamin Holzman



Wed, 23 Feb 2000 03:00:00 GMT  
 Range Parsing Issue



Quote:

>[posted & mailed]

>while (<INFILE>) {

>    $in_article = ($1 == $article_id);
>  }
>  print if $in_article;
>}

>Hope this helps,

>Benjamin Holzman

A really simple interpretation of what I think was asked for :

OUTER:
while (<INFILE>) {

Quote:
}

Jason Gloudon


Thu, 24 Feb 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Parsing issue

2. Parsing issue

3. newbie...To parse or not to parse

4. Text Parsing - Parse::RecDescent or another method?

5. Parsing with Parse::RecDescent

6. Parse::RecDescent and parsing comments

7. Help: Problem with simple parsing and Parse::RecDescent

8. Parsing with Parse::RecDescent

9. Parse::RecDescent stops parsing.

10. ranged arrays

11. CONTEST: Range Searching

12. range operator and regexps

 

 
Powered by phpBB® Forum Software