• 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: Unique Items in a text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unique Items in a text file


  • Subject: Re: Unique Items in a text file
  • From: Emmanuel <email@hidden>
  • Date: Mon, 8 Apr 2002 15:05:40 +0200

At 2:27 PM +0200 8/4/02, Steve Thompson wrote:
>
>I have written a script that loops through each line of data, looks at field
>8, compares it with a list of product codes and, if the product code isn't
>in the list, it adds it.

Here is what I would do:

- use "extractcolumn 8 ... as list" (Satimage osax) to make rapidly the 8th
column into a list of strings (for fastest execution, run it from Smile)
- sort the list (the fastest "sort" handler so far was provided in a recent
thread, I suggest you ask if you want more info on this point)
- read once the list (backwards), comparing successive items, and use
"suppress item" (Satimage osax) to remove duplicates.

(Caution: do not compare directly strings which may be longer than 32Kb)

The result should be the list of the product codes - in lexicographic order.

(Note: "sort" handlers can usually be customized to sort by numerical
order, or length of the string, or whatever, instead of lexicographic).

Emmanuel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Unique Items in a text file
      • From: Deivy Petrescu <email@hidden>
References: 
 >Unique Items in a text file (From: Steve Thompson <email@hidden>)

  • Prev by Date: OT: IPTC information via AppleScript
  • Next by Date: Re: Maxing out a list
  • Previous by thread: Unique Items in a text file
  • Next by thread: Re: Unique Items in a text file
  • Index(es):
    • Date
    • Thread