• 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: How to parse CSV
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to parse CSV


  • Subject: Re: How to parse CSV
  • From: Skeeve <email@hidden>
  • Date: Thu, 24 Jan 2008 20:05:58 +0100

Now THIS seems fast!

on run
set started to current date
set {oAStid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "|"}
set LoL to {}
repeat with rec in every paragraph of convert(choose file)
copy (a reference to text items of rec) to the end of LoL
end repeat
set AppleScript's text item delimiters to oAStid
set stopped to current date
display dialog "Seconds elapsed: " & (stopped - started)
return item 4 of (item 34900 of LoL)
end run


to convert(a_file)
return do shell script "perl -pe 'tr/\\012\\015//d; $_.=$/' " & quoted form of POSIX path of a_file
end convert


272 seconds for 35000 lines with 10 elements each.

Question is: How fast is woring with the items...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: How to parse CSV
      • From: Benedikt Quirmbach <email@hidden>
References: 
 >Re: How to parse CSV (From: Benedikt Quirmbach <email@hidden>)
 >Re: How to parse CSV (From: Skeeve <email@hidden>)

  • Prev by Date: Re: Mail.app Attachments Filter
  • Next by Date: Re: How to parse CSV
  • Previous by thread: Re: How to parse CSV
  • Next by thread: Re: How to parse CSV
  • Index(es):
    • Date
    • Thread