Re: HELP!!!
- Posted by Bryan Melugin <bmelugin at BELLSOUTH.NET> Jul 23, 1999
- 439 views
Thanks for the Help! I tried that and it produced this error edi.ex:10 type_check failure, line is -1 Global & Local Variables edi.ex: line = -1 data = <no value> f = 3 Did I do something obviously wrong here? Bryan JJProg at CYBERBURY.NET wrote: > 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/