Sign in to follow this  
Followers 0
sosimple

FileReadLine and Last line of a file

4 posts in this topic

Hi. I want to read the last line of a text file . How can I find the number of the last line to do this?

I use

$lineIwant = FileReadLine($file,$lastline) How can I make $lastline?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#Include <File.au3>
$NumberOfLines = _FileCountLines($file)
$ReadLastLine = FileReadLine($file, $NumberOfLines)

Kurt

EDIT: Forgot the File.au3 include

Edited by _Kurt

Awaiting Diablo III..

Share this post


Link to post
Share on other sites

Hi. I want to read the last line of a text file . How can I find the number of the last line to do this?

I use

$lineIwant = FileReadLine($file,$lastline) How can I make $lastline?

Maybe...

; Read the last line of a text file
; author - SmOke_N

$aSplit = StringSplit(StringStripCR(FileRead('FileLocation.Name')), @LF)
MsgBox(64, 'Last Line', $aSplit[$aSplit[0]])

There are many helpful additions to your script here

Autoit Wrappers ... Just the Best of the Best!!!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#Include <File.au3>
$NumberOfLines = _FileCountLines($file)
$ReadLastLine = FileReadLine($file, $NumberOfLines)

Kurt

EDIT: Forgot the File.au3 include

Thanks to all. I was trying about an hour to do this... This works excellent for me. It needs the File.au3 include. Thanks again.

Share this post


Link to post
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
Sign in to follow this  
Followers 0