Records Delimited by Blank Line

Gregory Lypny gregory.lypny at videotron.ca
Thu Jan 27 01:15:32 EST 2005


Hello everyone,

I'm processing a large text file where each record consists of several 
hundred lines of information and is separated from the next record by a 
single blank line.  I'd normally use a handler like the one below, 
where the variable recordDelimiter catches the characters that mark the 
end of one record and the beginning of another, but with the delimiter 
being a blank line in this case, I'm not sure what string I should set 
recordDelimiter to.  I suspect it's something obvious, and I'm just 
suffering from a mental block (story of my life).

open file filePath for read
   repeat
     read from file filePath until recordDelimiter
     put the result into resultOfRead  -- Check for eof.
     -- Do stuff with the record here.
     if resultOfRead is "eof" then exit repeat
   end repeat

Any suggestions would be most appreciated.

Regards,

	Greg


More information about the use-livecode mailing list