Reading txt file line by line
Reading txt file line by line
- Subject: Reading txt file line by line
- From: Jeff Horton <email@hidden>
- Date: Tue, 16 Oct 2001 15:30:02 -0400
Hello all.
I have a rather large text file that I'd like to read into line by line.
So far I have the following:
on open fileList
repeat with oneFile in fileList
set oneFile to oneFile as string
tell application "Finder"
set fileName to name of file oneFile as text
if not (fileName ends with ".txt") then
display dialog "Cannot process file " & fileName & " because
it is not a text file!" buttons "OK" default button 1 with icon 2
else
set OPENFILE to open for access file oneFile
set oneLine to read OPENFILE until return as {text} using
delimiter {tab, return}
end if
end tell
end repeat
end open
The part that I want to use is the:
set oneLine to read OPENFILE until return as {text} using
delimiter {tab, return}
But I want to repeat thru every line without having to read the entire file
into my variable. What I am asking is after getting the first line returned
to me, how do I then do the same line of code for the 2nd, 3rd, 4th, etc....
Hope I explained myself clearly.
Jeff Horton