Quantcast
Viewing latest article 5
Browse Latest Browse All 794

Getting Started with LiveCode - Complete Beginners • Get the last two columns

Hello,

I'm trying to get some info from a text file, and the data of the text file looks like this:
Gainesville,Libra,5684,1987,Hurp1987,Bedford
Feather Sound,3513,1942,Jons1942,Flores
Marysville,Sagittarius,6638,1963,Subjes,Williams
Orange,Leo,5592,1986,38,Dandrall,Wolf
As you can see each line has different number of items; and there are more lines in the data that have more number of items.

I just want to get the last two items from each line which should look like this:
Hurp1987,Bedford
Jons1942,Flores
Subjes,Williams
Dandrall,Wolf
I know the result can be got by using the repeat loop, but I'm interested in using the split and combine command since the data I'm gonna process is huge, like 300-500 mb in size, so definitely repeat loop will take a longer time, and my pc wont be able to handle it I fear.

I already written the script like this:

CODE:

set the columndel to ","split tText by column -- tText is the variable that holds the dataput tText[-2] into fld "f1"put tText[-1] into fld "f2"
Unfortunately LC doesn't get the last columns like that Image may be NSFW.
Clik here to view.
:(


If anyone can tell me or show an example of how to get the last columns, or even if there's a quickest way to get the result, I'll be glad to learn, and your help will be so much appreciated Image may be NSFW.
Clik here to view.
:)
but please remember, it's gonna handle a huge data, so the quickest way is welcome Image may be NSFW.
Clik here to view.
:)

Statistics: Posted by xoxiwe — Sun Feb 23, 2025 5:10 am



Viewing latest article 5
Browse Latest Browse All 794

Trending Articles