This seemed like an interesting challenge so I decided to create a task to read the last line of a file - even when there are 10s of thousands of lines!
This task uses Tasker's file read line action. It searches for the last line and then captures it. It isn't too fast but it works.
Here is the task description.
csv (57)
A1: [X] Variable Set [ Name:%offset To:100 Do Maths:Off Append:Off ]
A2: Variable Set [ Name:%line To:10000 Do Maths:Off Append:Off ]
<10000s>
A3: Read Line [ File:Download/trackLog.csv Line:%line To Var:%temp Continue Task After Error:On ]
A4: If [ %temp !~ EOF ]
A5: Variable Set [ Name:%line To:%line + 10000 Do Maths:On Append:Off ]
A6: Goto [ Type:Action Label Number:3 Label:10000s ]
A7: Else
A8: [X] Flash [ Text:%line Long:Off ]
A9: End If
A10: Variable Set [ Name:%line To:%line - 10000 Do Maths:On Append:Off ]
<1000s>
A11: Read Line [ File:Download/trackLog.csv Line:%line To Var:%temp Continue Task After Error:On ]
A12: If [ %temp !~ EOF ]
A13: Variable Set [ Name:%line To:%line + 1000 Do Maths:On Append:Off ]
A14: Goto [ Type:Action Label Number:3 Label:1000s ]
A15: Else
A16: [X] Flash [ Text:%line Long:Off ]
A17: End If
A18: Variable Set [ Name:%line To:%line - 1000 Do Maths:On Append:Off ]
<100s>
A19: Read Line [ File:Download/trackLog.csv Line:%line To Var:%temp Continue Task After Error:On ]
A20: If [ %temp !~ EOF ]
A21: Variable Set [ Name:%line To:%line + 100 Do Maths:On Append:Off ]
A22: Goto [ Type:Action Label Number:11 Label:100s ]
A23: Else
A24: [X] Flash [ Text:%line Long:Off ]
A25: End If
A26: Variable Set [ Name:%line To:%line - 100 Do Maths:On Append:Off ]
<10s>
A27: Read Line [ File:Download/trackLog.csv Line:%line To Var:%temp Continue Task After Error:On ]
A28: If [ %temp !~ EOF ]
A29: Variable Set [ Name:%line To:%line + 10 Do Maths:On Append:Off ]
A30: Goto [ Type:Action Label Number:19 Label:10s ]
A31: Else
A32: [X] Flash [ Text:%line Long:Off ]
A33: End If
A34: Variable Set [ Name:%line To:%line - 10 Do Maths:On Append:Off ]
<1s>
A35: Read Line [ File:Download/trackLog.csv Line:%line To Var:%temp Continue Task After Error:On ]
A36: If [ %temp !~ EOF ]
A37: Variable Set [ Name:%line To:%line + 1 Do Maths:On Append:Off ]
A38: Goto [ Type:Action Label Number:27 Label:1s ]
A39: Else
A40: [X] Flash [ Text:%line Long:Off ]
A41: End If
A42: Variable Set [ Name:%lastline To:%line - 1 Do Maths:On Append:Off ]
A43: [X] Flash [ Text:%lastline Long:Off ]
A44: Read Line [ File:Download/trackLog.csv Line:%lastline To Var:%data Continue Task After Error:On ]
A45: Flash [ Text:%data Long:Off ]
A46: Variable Split [ Name:%data Splitter:, Delete Base:On ]
A47: Variable Set [ Name:%avg_mpg To:%data(17) Do Maths:Off Append:Off ]
A48: Flash [ Text:Trip Avg. mpg
%avg_mpg Long:On ]