is it possible to readfromfile line x to y

Dar Scott Consulting dsc at swcp.com
Sat Aug 10 14:00:25 EDT 2019


Sorry about that. The https reference threw me off.

Use open file, read file with range (repeatedly), and then close file.
	
	open file myBigFile for UTF-8 text read
	read from file myBigFile at myOffset for myNumLines lines
	close...

Adjust myOffset with the length of what was read each time.





> On Aug 10, 2019, at 11:26 AM, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Hi Dar, thanks for the tips.  However I am loading the file locally.
> 
> The file is 48mb, so it loads fine and fits fine.
> 
> I am attempting to parse just 1 line at a time, but it still doesn't work.
> 
> This is my code and even this freezes it.
> 
> -----------------------------------------------------------------------------------------
> 
> local number_of_lines
> local this_line
> global TempArray
> 
> put the number of lines in unicode_file_to_parse into number_of_lines
> 
> repeat with x = 1 to number_of_lines
> 
> put line x of unicode_file_to_parse into this_line
> 
> put this_line into TempArray[x]
> 
> end repeat
> 
> 
> 
> On Sat, Aug 10, 2019 at 1:16 PM Dar Scott Consulting via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> Remember to unload after load and parsing (if you use load).
>> 
>> Also, look for variables you are leaving full of big things.
>> 
>> If that doesn't help enough, look at the httpHeaders property. Use the
>> Range request header. Unfortunately, that might be limited to byte as a
>> unit. If so, you might also want to add a Accept-Charset header to limit
>> the charset to utf-16 so you don't split a character in a read.
>> 
>> A quick scripting but slow running interim alternative might be to URL the
>> file, get the lines you want, and then empty the variable containing the
>> file.
>> 
>>> On Aug 10, 2019, at 9:18 AM, Tom Glod via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>> 
>>> I am trying to parse this massive html page of unicode characters.
>>> 
>>> https://unicode.org/emoji/charts/full-emoji-list.html
>>> 
>>> and livecode is choking up when I read in the whole file and try to parse
>>> each line using a loop.  I get a hard crash in the debugger and a endless
>>> loop when debugger is off.
>>> 
>>> I will report this afterwards.
>>> 
>>> But as a workaround I'd like to
>>> 
>>> "read from file line 1 to 5 of file"
>>> 
>>> The examples are just not helping me to get the right syntax.  Can
>> someone
>>> help me?
>>> 
>>> I'm parsing lines.
>>> 
>>> Thanks,
>>> 
>>> Tom
>>> _______________________________________________
>>> 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
>> 
>> 
>> _______________________________________________
>> 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
>> 
> _______________________________________________
> 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