Copy the Last Line of a .txt file

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Copy the Last Line of a .txt file

Post by bogs » Wed Mar 12, 2025 7:59 pm

trags3 wrote:
Sat Oct 07, 2023 6:00 pm
To accomplish this I want to read the last line in the appropriate file and populate the card with the data.
If the goal is simply to get the last line of a file, assuming you have the path to the file already in a variable, all you should need is

Code: Select all

     
      put the last line of url("File:" & myFilePath) into myVariable 
      # this assumes you already have a routine to place the variable items into their respective fields
The above code with a CSV file of 1GB in size completed in 746 milliseconds (including putting the information into fields).
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Copy the Last Line of a .txt file

Post by richmond62 » Wed Mar 12, 2025 8:00 pm

Err, but 18 months later?

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Copy the Last Line of a .txt file

Post by bogs » Thu Mar 13, 2025 9:15 am

richmond62 wrote:
Wed Mar 12, 2025 8:00 pm
Err, but 18 months later?
I wasn't here for a long LONG time (and really still am not), however, I did not resurrect this thread and bring it to my own attention, the post that did that was made by the OP, 1 day before my reply.
Re: Copy the Last Line of a .txt file
by trags3 » Tue Mar 11, 2025 3:48 pm
I just read through a thread brought to the surface again as is my habit.
Image

Post Reply