tags:

views:

16

answers:

2

Some software I use generates a list of e-mail addresses based on some criteria, but some people have multiple criteria, so I end up with two big lists of addresses with some duplicate entries. What's the easiest way to remove the duplicates, so users don't receive two emails?

To clarify:

I want to e-mail all people who are aged 50 or over, or like cats.

I run a query for 50+ people, and copy their emails into outlook, then I run a query for people who like cats and paste those in. People who are over 50 and like cats end up coming up in both searches and get their email pasted in twice...

A: 

To be honest, this doesn't really sounds like much of a programming problem, but if it were then you've got a code-based approach

  1. Grab the two lists into arrays
  2. merge the arrays
  3. remove duplicates
  4. Use this list

or a database-based approach

  1. Insert each list into a database table
  2. Do a select distinct
  3. Now paste the results into Outlook.
Unsliced
+1  A: 

You could copy the lists of addresses to two text files, and then:

(cat over50.txt likecats.txt) | sort | uniq >over50andlikecats.txt
Greg Hewgill