read from file until a line begins with a certain word

Paul Dupuis paul at researchware.com
Sun Sep 17 09:18:01 EDT 2017


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, Matthias Rebbe via use-livecode wrote:
> 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 310000
> ‌wirmachen.software <http://wirmachen.software/>‌
>
>> Am 17.09.2017 um 12:55 schrieb Paul Dupuis via use-livecode <use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>:
>>
>> 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 file until a line that starts with a certain keyword, e.g. mstart. I need to read until the line before that line which starts with mstart.
>>> And then read from that “mstart” line until the next line before “mstart”.
>>> Do i have to read line by line and check if the line starts with that keyword or is there also an other way? 
>>>
>>> Maybe i am thinking to complicated.
>>>
>> Why can you not use the
>> read from file tFilePath until "mstart"
>> of
>> read from {file /pathName/ | stdin} [at /start/] {until {/string/ | end
>> | EOF | empty} | for /amount/ [/chunkType/]} [in /time/]
>>
>> If you need to back up to reread the "mstart" string you can then use
>> Seek to adjust the read position if needed.
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode <http://lists.runrev.com/mailman/listinfo/use-livecode>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode






More information about the use-livecode mailing list