Closed Thread Icon

Topic awaiting preservation: The Diffrence Pages that link to <a href="https://ozoneasylum.com/backlink?for=13126" title="Pages that link to Topic awaiting preservation: The Diffrence" rel="nofollow" >Topic awaiting preservation: The Diffrence\

 
Author Thread
Trigger
Paranoid (IV) Inmate

From:
Insane since: Jun 2002

posted posted 04-08-2004 16:45

Ok I have two text files, contaning a list of email address.. I have 'genesisemail.txt" and email.txt

email.txt are all the email address we have on our mailing list and genesisemail.txt are the email address of all the users on our system,

We want to add all our users onto the system and so need to find out what email address from genesisemail.txt we don't have in email.txt...

What would the best way to do this? I tried the 'diff' command In my shell, but It just gave me some garble and ocnfusing output..

I figure this is a preety common thing compareing the diffrences in two files, so how would I do it?

Thanks
Trigger

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 04-08-2004 17:36

well... diff wouldn't help here, since the files are proably not in the same order.

Honestly, I do such things with a throw away python, or php, script.

read email, explode, possibly get it into an associative array (removing duplicates at the same time),
read genesisemail, explode ,loop over contents, set entrys into associative arrays, get keys() of array, implode, write to new file, done. I'd b probably less code than the explanation I just wrote out

so long,
Tyberius Prime

Edit: Or I'd use php->array_diff()

[This message has been edited by Tyberius Prime (edited 04-08-2004).]

[This message has been edited by Tyberius Prime (edited 04-08-2004).]

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 04-08-2004 17:43

diff is the tool you want most of the time. However, there is also a tool called "comm" which might do what you want.

This program prints out 3 columns of text after matching them. Column 1 is entries only in file 1 column 2 is entries in only file 2, and column 3 is entries found in both files.

You can use the arguments -1

Trigger
Paranoid (IV) Inmate

From:
Insane since: Jun 2002

posted posted 04-08-2004 18:03

Kudos guys much appreciated.

« BackwardsOnwards »

Show Forum Drop Down Menu