recording duplicate items in a list
Posted: Sun Aug 03, 2014 10:52 am
I have a list of items such as in example list 1 shown below.
I want to record how many are the same but only the same by char 1 to 2 and char 6 to 7 then place that number of duplicates after each line, as in example list 2.
In other words: if chars 1,2,6,7 are the same as others in another line then put that total after those lines.
Any ideas for doing this?
Thanks,
sims
---
LIST 1
08:00_d3_180_Monica_pink
10:45_d2_90_Mary_orange
10:00_d2_90_Mary_orange
10:15_d2_90_Mary_orange
10:30_d2_90_Mary_orange
10:00_d2_90_Mary_orange
10:00_d2_90_Mary_orange
12:30_d5_45_Mary_blue
12:45_d5_45_Mary_blue
12:60_d5_45_Mary_blue
LIST 2
08:00_d3_180_Monica_pink_1
10:45_d2_90_Mary_orange_3
10:00_d2_90_Mary_orange_3
10:15_d2_90_Mary_orange_3
10:30_d6_90_Mary_orange_2
10:00_d6_90_Mary_orange_2
10:00_d3_90_Mary_orange_1
12:30_d5_45_Mary_blue_3
12:45_d5_45_Mary_blue_3
12:60_d5_45_Mary_blue_3
I want to record how many are the same but only the same by char 1 to 2 and char 6 to 7 then place that number of duplicates after each line, as in example list 2.
In other words: if chars 1,2,6,7 are the same as others in another line then put that total after those lines.
Any ideas for doing this?
Thanks,
sims
---
LIST 1
08:00_d3_180_Monica_pink
10:45_d2_90_Mary_orange
10:00_d2_90_Mary_orange
10:15_d2_90_Mary_orange
10:30_d2_90_Mary_orange
10:00_d2_90_Mary_orange
10:00_d2_90_Mary_orange
12:30_d5_45_Mary_blue
12:45_d5_45_Mary_blue
12:60_d5_45_Mary_blue
LIST 2
08:00_d3_180_Monica_pink_1
10:45_d2_90_Mary_orange_3
10:00_d2_90_Mary_orange_3
10:15_d2_90_Mary_orange_3
10:30_d6_90_Mary_orange_2
10:00_d6_90_Mary_orange_2
10:00_d3_90_Mary_orange_1
12:30_d5_45_Mary_blue_3
12:45_d5_45_Mary_blue_3
12:60_d5_45_Mary_blue_3