How Read a file from particular line

Hello ,

Good Day !

We have scenario where we need read a file from a particular line (and line number is dynamic) it changes from execution to execution .

I have tried below code but eggplant is copying whole text file .

Read into Logtxt until eof from file “D:\Eggplant\logdata\aps.log” at LogCount

LogCount is variable which have line number

Hi @bhaavan ,

The Read from file command File and Folder Interaction | EPF Docs does take an optional at startPos parameter, but that is the start position based on bytes of data, not lines. Try this code:

put the number of lines of File "C:\TestPlant\logs\em.log" into myLineCount
put 7 into LogCount
put lines LogCount..myLineCount of File "C:\TestPlant\logs\em.log"

Even easier, there is no need to count the number of lines first, just use “last”:

set startingLine to 7
put lines startingLine to last of file "D:\Eggplant\logdata\aps.log" into Logtxt