Re: Unique Items in a text file
Re: Unique Items in a text file
- Subject: Re: Unique Items in a text file
- From: Deivy Petrescu <email@hidden>
- Date: Mon, 8 Apr 2002 09:19:19 -0400
At 3:05 PM +0200 4/8/02, Emmanuel wrote:
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
Emmanuel, since I may have missed the thread, is this "new" sort
routine different than the one you posted previously?
Thanks
--
Deivy Petrescu
http://www.dicas.com
_______________________________________________
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.