Jump to content

Reading end lines of a file (Tail)


Recommended Posts

The only thing I have seen was everyone recommending Randallc's TailRW.

However, his examples seem confusing and they cause AutoIT.exe to crash. I am not sure if I am doing something wrong or it's not made for Windows 7.

Either way, I am looking for something super simple, like this:

_FileReadLine($iLine)

Where if $iLine is negative, it takes the end lines. Thus: _FileReadLine(-100) retrieves the last 100 lines of a file.

If its not possible to read lines, then I would be OK with reading a number of [b/b]ytes. I am also interested in reading in the first 100 lines without loading all of them.

Please don't recommend using FileReadToArray and processing it that way. I am looking for something that can do a 5-10GB file in under 1/2 second.

Edited by ParoXsitiC
Link to comment
Share on other sites

Open the file in binary mode with FileOpen() and use FileRead() to read? You can use FileSetPos() to move around in the file. Sounds right in my head ;)

You need an example?

Link to comment
Share on other sites

Open the file in binary mode with FileOpen() and use FileRead() to read? You can use FileSetPos() to move around in the file. Sounds right in my head ;)

You need an example?

I knew of FileOpen and FileRead, but not FileSetPos. However, this works good for bytes, but it would be preferable if I could indicate how many lines.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...