Showing results for 
Search instead for 
Did you mean: 
Reply

How to read the x last lines of a text file

How to read the x last lines of a text file

It is certainly easy for you but I don't see how to read the x last
lines of a text file.

Using the ReadFile.vi we can choose the pos mode (top, end of file )
defining the position of the cursor but with the cursor at the end of
the file how to read the last line, the last-1 line, last-2 ... ?
It must exist a method to do that.
Thank you for helping me.
Michel Verhelpen
0 Kudos
Message 1 of 2 (742 Views)
Reply
0 Kudos

Re: How to read the x last lines of a text file

Michel Verhelpen writes:

> It is certainly easy for you but I don't see how to read the x last
> lines of a text file.
>
> Using the ReadFile.vi we can choose the pos mode (top, end of file )
> defining the position of the cursor but with the cursor at the end of
> the file how to read the last line, the last-1 line, last-2 ... ?
> It must exist a method to do that.
> Thank you for helping me.
> Michel Verhelpen

Michael,

what about getting the dimensions of the array of lines and using
array subset with a start of last -2 and an end of last?

Johannes Niess
0 Kudos
Message 2 of 2 (742 Views)
Reply
0 Kudos