getting duplicates in a list by item id
getting duplicates in a list by item id
- Subject: getting duplicates in a list by item id
- From: "Patrik B." <email@hidden>
- Date: Fri, 24 Aug 2007 11:48:19 -0700
I have a list over over 10,000 posix paths. A lot of the paths are identical
so what I want to do is compare it to itself and consolidate it.
example text file which only contains posix path the additional text is for
explanation only
POSIX path 1 -- Joe - line 1 of file return is the delimiter
POSIX path 2 -- Moe - line 2 of file
POSIX path 3 -- Joe - line 3 of file
POSIX path 4 -- John - line 4 of file
POSIX path 5 -- Moe - line 5 of file
POSIX path 6 -- Steve - line 6 of file
POSIX path 7 -- apple - line 7 of file
POSIX path 8 -- pie - line 8 of file
POSIX path 9 -- Janet - line 9 of file
POSIX path 10 -- Caroline - line 10 of file
POSIX path 11 -- apple - line 11 of file
All posix paths are read by my script into applescript - this is easy so far
and I can also easily cycle through them.
Now what I need help with is how I get a new list that has each path only
occuring only once and another variable that gives me the line number i.e.
1,3 for each separated by a comma ideally.
So that I end up with two variables (one containing all paths only occuring
once and the other containing all the line numbers.
new POSIX path and then a list of
Example
variable 1 variable 2
PATH 1 -- 1,3
PATH 2 -- 2,5
-- path 3 was left out as it is now covered in the variable 2 - 1st line
PATH 4 -- 4
Any ideas on how I do this sorting smartly?
This is how far I got:
repeat with i in variable1
if variable1 contains i then -- I am not sure how I filter the id as well as
get the count of occurences here
set end of mynewvariable2 to item number & ","
set end of mynewvariable1 to i
end
end
Patrik
_______________________________________________
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