• 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 compare two lists without looping? possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to compare two lists without looping? possible?


  • Subject: Re: how to compare two lists without looping? possible?
  • From: "Chris Tangora" <email@hidden>
  • Date: Thu, 9 Feb 2006 17:04:19 -0500

You wouldn't have to do a loop if you have two files to compare. Instead of making two list, try making two text files. One file with the numbers you want, the other with the numbers you have (being the bigger of the two).

For this example I am using the files 2items (for the wanted numbers) and 4items (for the bigger group of numbers). Make a folder in the shared directory named number_cruncher and try this....

set find_diff to "sort -n /users/shared/number_cruncher/2items /users/ shared/number_cruncher/4items | uniq -d > users/shared/ number_cruncher/difference"
set find_same to "sort -n /users/shared/number_cruncher/2items /users/ shared/number_cruncher/4items | uniq -d > users/shared/ number_cruncher/similarities"


do shell script find_diff
do shell script find_same

the results should be two separate files. One that has the differences between the two files, and one that has the similarities between the two. Seems really quick, but I'm on a G5 iMac so most things seem quick.

if you are looking to get the values into a variable inside Applescript, try...

set diff_variable to paragraphs of do shell script "sort -n /users/ shared/number_cruncher/2items /users/shared/number_cruncher/4items | uniq -d"

No guarantees, as it is now 5pm and I am outta here!

If this isn't what you were looking for, can't use it or just doesn't work, shoot me an email.


chris _______________________________________________ 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
  • Follow-Ups:
    • Re: how to compare two lists without looping? possible?
      • From: Adam Bell <email@hidden>
    • Re: how to compare two lists without looping? possible?
      • From: Adam Bell <email@hidden>
References: 
 >Re: how to compare two lists without looping? possible? (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: how to compare two lists without looping? possible?
  • Next by Date: Re: how to compare two lists without looping? possible?
  • Previous by thread: Re: how to compare two lists without looping? possible?
  • Next by thread: Re: how to compare two lists without looping? possible?
  • Index(es):
    • Date
    • Thread