• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Reading txt file line by line
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: hash arrays and other mysteries
  • Next by Date: Quark 4.11 + OS X 10.1 = ?
  • Previous by thread: Re: hash arrays and other mysteries
  • Next by thread: Re: Reading txt file line by line
  • Index(es):
    • Date
    • Thread