Created
July 8, 2016 06:26
-
-
Save SmugZombie/0720931b2439fdb2d01d5870d1c7e67f to your computer and use it in GitHub Desktop.
tail.ahk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Allows you to tail a file providing the path | |
Tail(k,file) ; Return the last k lines of file | |
{ | |
Loop Read, %file% | |
{ | |
i := Mod(A_Index,k) | |
L%i% = %A_LoopReadLine% | |
} | |
L := L%i% | |
Loop % k-1 | |
{ | |
IfLess i,1, SetEnv i,%k% | |
i-- ; Mod does not work here | |
L := L%i% "`n" L | |
} | |
Return L | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment