• 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: Working with big lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Working with big lists


  • Subject: Re: Working with big lists
  • From: "Mark J. Reed" <email@hidden>
  • Date: Sun, 22 May 2005 16:13:31 -0400

Note that uniq requires the file to be pre-sorted; all the "apples" must be together, etc.  If it's not, you can use sort to get it that way:

set countInfo to do shell script "sort" & quoted form of (POSIX path of theFile) & " | uniq -c"

On 5/22/05, Daniel Jalkut < email@hidden> wrote:
Hi Rob - this output is almost identical in format to the results of the "uniq" shell tool.  

Play around with the results of this script:

set theResult to ""
set theFile to choose file
set theContents to every paragraph of (do shell script "cat " & quoted form of (POSIX path of theFile))
set countInfo to do shell script "uniq -c " & quoted form of (POSIX path of theFile)

The tool has been around so long I imagine it's probably pretty efficient.

Daniel

On May 22, 2005, at 11:58 AM, Rob Stott wrote:

I want to be able to read it and get;

apple    3
orange    2
pear    1


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (




--
Mark J. Reed <
email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Waiting for script to exit (From: Christopher Brown <email@hidden>)
 >Re: Waiting for script to exit (From: Christopher Brown <email@hidden>)
 >Working with big lists (From: Rob Stott <email@hidden>)
 >Re: Working with big lists (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Re: Working with big lists
  • Next by Date: Re: Working with big lists
  • Previous by thread: Re: Working with big lists
  • Next by thread: Re: Working with big lists
  • Index(es):
    • Date
    • Thread