How to get only the last line of a text file?

I’ve looked at other text reading examples and haven’t seen what it is I’m trying to do. In an analysis I want to return the last line of a specific text file. The line will vary in each instance. If it helps, the line immediately preceding the last line ends with a colon. Ideas on how I’d go about this?

You can specify a line number, like

line 1 of file "c:\temp\test.txt"

We can also query to determine the number of lines in a file. Combining the two we can retrieve the last line with

lines (number of lines of it) of file "c:\temp\test.txt"

2 Likes