Not that anybody asked, but I do a lot of scanning big text files.
My fastest algorithm for this is below.
It does 411K lines in 18 seconds on my cheezy PC.
InFile = "SomeLargeFile.txt"
AddExtender("wilx44i.dll",0,"wilx64i.dll")
FileSiz = filesize(InFile) ; size of file
BB = binaryalloc(FileSiz) ; reserve space
binaryreadEX(BB,0,InFile,0,FileSiz) ; gulp the file
LoopStruct = binarytaginit(BB, "", @lf) ; set up to scan text lines
LineNum = 0
while 1
LoopStruct = binarytagfind(LoopStruct) ; advance to next line
if LoopStruct == "" then break ; all done?
LineNum += 1
TheLine = binarytagextr(LoopStruct,1) ; the line text
LinePtr = xhex(strsub(LoopStruct,5,12)) ; optional: binary offset
; OK do stuff here
endwhile
message('line count', LineNum)
exit