Hi I am in need of an apple script or grep or sed or whatever

Script to clan up a long list of emails like thousands. I need it to remove all duplicates.
it is line an normal email.
either < jimmy >
jimmy@ipodlane.com, ...
or a mixture of :
jm_j@ipodlane.net.cu,
and any other version there of.
basicly I would guess that it would just scan a line from , to , and delete all copy of any line , I would then clean up whatever else.
please help.