|Think about Loose Coupling|
Removing users from a listby gossamer (Acolyte)
|on Sep 09, 2012 at 00:14 UTC||Need Help??|
gossamer has asked for the
wisdom of the Perl Monks concerning the following question:
I'm relatively new to perl and having some trouble with what I'd imagine is a classic issue for perl. I'd like to remove a list of email addresses in one file that appear in another.
In other words, given file removelist.txt, which contains:firstname.lastname@example.org
In some cases the lines may appear like this:
due to bad HTML email clients. I'd like to remove all occurrences of each of the lines of the file from the file masterlist.txt, ignoring case.
I've played around with it a bit, but having trouble removing all at once, instead of iterating through the file and creating a temporary file for each email address in the removelist file.
I've also tried a combination of sed with egrep, but haven't figured out how to add a pipe character for the 'or' at the end of each line of the removelist.txt file except the last line.
Thanks for any ideas.