[ back to toc ]

Parsing A strange File Structure

Date: 2002/03/27 21:23

Q:
I need to parse a file, with a strange structure:
Line 1 URL
Line 2 Time & Date
Line 3 Description
Line 4 other info
Line 5 Blank Line!
Line 6 URL
Line 7 Time & Date
Line 8 Description
Line 9 other info
Line 10 Blank Line!
..
..

I want to parse four lines, skip the blank line, and print out to a file
the data in giid order (comma delimeted maybe?)

How do I do it?
Thanks!
Ofir

A:
You have to program a loop where each loop reads four (well, five) lines.
For example:

while(1){
$URL = <>;
$TimeAndDate = <>;
$Description = <>;
$OtherInfo =<>;
<>; #skip the blank line

Do whatever you want with the record

last if eof;

}

Regards,
Peter

[ back to toc ]