• 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
Re: counting the records in a tab-delimited text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: counting the records in a tab-delimited text file


  • Subject: Re: counting the records in a tab-delimited text file
  • From: Bill White <email@hidden>
  • Date: Fri, 21 Dec 2001 14:55:10 -0500

> Can anyone give me a simple way of counting the number of records
> (return-delimited records) in a tab-delimited text file? I know I can go
> through and read each character, counting each return, but that seems like a
> really inefficient way of getting the count. Thanks in advance,
>
Try using text item delimiters:

set theFile to read file "Hard drive:Desktop folder:Text file" -- change to
suit

set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to return

set recordCount to (count (text items of theFile)) - 1

set AppleScript's text item delimiters to oldDelims

return recordCount

HTH,

Bill


  • Prev by Date: Re: [ADMIN] Reminder: turn off the list before turning on your vacation responder
  • Next by Date: RE: <<data>> instead of useful info
  • Previous by thread: counting the records in a tab-delimited text file
  • Next by thread: Re: counting the records in a tab-delimited text file
  • Index(es):
    • Date
    • Thread