Re: read from file until a line begins with a certain word

2017-09-18 Thread Bob Sneidar via use-livecode
How about read for x characters, put the last line in a buffer and remove it from the read text, process the read text, read the next block, prepend the buffer line. Bob S > On Sep 16, 2017, at 17:50 , Matthias Rebbe via use-livecode > wrote: > > Hi, > > until today i used always put URL

Re: read from file until a line begins with a certain word

2017-09-17 Thread J. Landman Gay via use-livecode
On 9/17/17 7:16 PM, J. Landman Gay via use-livecode wrote: You're right of course, I had a thinko. It should have been this, btw: on parseFile put "/path/to/file" into tFile put cr & "mstart" into tDelim open file tFile for read repeat read from file tFile until tDelim if it =

Re: read from file until a line begins with a certain word

2017-09-17 Thread J. Landman Gay via use-livecode
You're right of course, I had a thinko. On 9/17/17 4:15 PM, Monte Goulding via use-livecode wrote: On 18 Sep 2017, at 6:13 am, Matthias Rebbe via use-livecode wrote: thanks for that code sample. I was not aware that i can use EOF in a repeat loop as condition. I always thought that it only

Re: read from file until a line begins with a certain word

2017-09-17 Thread Matthias Rebbe via use-livecode
Thanks for mentioning this. At the moment i stop reading the file after the tenth finding. So i did not yet run into a problem. Adjusted my script now. Regards, Matthias Matthias Rebbe +49 5741 31 ‌wirmachen.software ‌ > Am 17.09.2017 um 23:15 schrieb Monte Go

Re: read from file until a line begins with a certain word

2017-09-17 Thread Monte Goulding via use-livecode
> On 18 Sep 2017, at 6:13 am, Matthias Rebbe via use-livecode > wrote: > > thanks for that code sample. I was not aware that i can use EOF in a repeat > loop as condition. I always thought that it only can be used in a read > command like I was not aware of it either and can’t see anything i

Re: read from file until a line begins with a certain word

2017-09-17 Thread Matthias Rebbe via use-livecode
Jacque, thanks for that code sample. I was not aware that i can use EOF in a repeat loop as condition. I always thought that it only can be used in a read command like read from file MyFile until EOF Thanks again to all who gave feedback. It helped me a lot. Regards, Matthias Matthias Rebb

Re: read from file until a line begins with a certain word

2017-09-17 Thread J. Landman Gay via use-livecode
On 9/17/17 8:18 AM, Paul Dupuis via use-livecode wrote: concatenating a cr (or whatever line delimiter the file uses if opening as binary) before mStart and reading from file until that string will find all instances but the 1st line of the file (it the file starts with mstart) I think it shoul

Re: read from file until a line begins with a certain word

2017-09-17 Thread dunbarx via use-livecode
The fact that the keyword both starts lines and is also embedded within lines makes me believe even more that the required processing work within LC, and not in gadgetry in the "read" command. A keyword that starts a sentence may not have a return in front of it. That would only occur if it starte

Re: read from file until a line begins with a certain word

2017-09-17 Thread Paul Dupuis via use-livecode
So a line starting with "mstart" would be cr&mstart concatenating a cr (or whatever line delimiter the file uses if opening as binary) before mStart and reading from file until that string will find all instances but the 1st line of the file (it the file starts with mstart) On 9/17/2017 7:33 AM,

Re: read from file until a line begins with a certain word

2017-09-17 Thread Matthias Rebbe via use-livecode
What i forgot to mention was that the keyword also exists within the lines. But i have to find/read until a line which starts with mstart. But anyway i will play around a little bit. Thanks so far for all your comments. Regards, Matthias Matthias Rebbe +49 5741 31 ‌wirmachen.software

Re: read from file until a line begins with a certain word

2017-09-17 Thread Paul Dupuis via use-livecode
On 9/16/2017 8:50 PM, Matthias Rebbe via use-livecode wrote: > Hi, > > until today i used always put URL to read a complete file into memory. But > now i have to process really large text files with a size of 900 - 1500 MB. > I know i can read a file until EOF or so. > > But how would i read a fi

Re: read from file until a line begins with a certain word

2017-09-16 Thread Colin Holgate via use-livecode
One thought, what if you read overlapping chunks. Like, read from 0-1, then from 9900-2, etc. If the overlap is longer than your test string you would still be able to pick it up, in the cases where the string spanned the chunk boundary. First test could be to read in 1 chunks and t

Re: read from file until a line begins with a certain word

2017-09-16 Thread dunbarx via use-livecode
I would just read the whole file and then let LC truncate the text following the keyword sentence in the usual ways. I bet even with a couple of gigabytes this would not take much time. Craig Newman -- Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

read from file until a line begins with a certain word

2017-09-16 Thread Matthias Rebbe via use-livecode
Hi, until today i used always put URL to read a complete file into memory. But now i have to process really large text files with a size of 900 - 1500 MB. I know i can read a file until EOF or so. But how would i read a file until a line that starts with a certain keyword, e.g. mstart. I need