Re: HELP!!!
- Posted by JJProg at CYBERBURY.NET Jul 23, 1999
- 430 views
EU>I'm new to Euphoria and have gone through the tutorial. My question EU>will be easily answered by any one of you Euphoria Guru's out there. EU>Here it goes. Can someone tell me how to pull information from a text EU>file which includes only the information between two lines. Say I have EU>a line that starts with ST and then there are 40 lines down and then EU>there is a line that starts with SE. If I want just the info between ST EU>and SE and put it into a different text file, can that be done? Any EU>help would be greatly appreciated. I have been working on this for 3 EU>days now and I've almost given up hope. EU>Thanks again EU>Bryan Try this: constant START = "ST\n" -- gets returns a new line character at the end -- of a line constant END = "SE\n" sequence line, data integer f f = open("infile.txt","r") line = gets(f) while not equal(line,START) do -- Skip all data before and including -- START line = gets(f) end while data = "" line = gets(f) while not equal(line,END) do -- Get all the data up to END data &= line line = gets(f) end while close(f) f = open("outfile.txt","w") puts(f,data) -- Write the data to the output file close(f) Jeffrey Fielding JJProg at cyberbury.net http://members.tripod.com/~JJProg/