Remove the Content of 1 text file from another

I have a list of emails, consist of about 2700 email addresses of my company’s customers. This list will be increased in future as company is growing.

Few days ago I send newsletters to those customers and found that mail couldn’t be delivered to 450 customers due to email address is (wrong | not active | rejected)

I collect those address into a text file, Now I want to remove those addresses from main mailing list. Because next time I don’t want to put this burden on my mail sending software.

How can I remove those address, Is there a software solution that can read a file, match its contents with another and remove failed list from main list.

It is not a big deal, I can spend few hours and do that manually but if a software could do that I can save my time.

Thanks

Re: Remove the Content of 1 text file from another

If you have linux , you can do it through command line.

I am quite sure a "ULTRA-EDIT PRO" will be able to do it for you

Edit: Well you can create a custom function in Excel as well, but that will require quite technical knowledge

Re: Remove the Content of 1 text file from another

Hopefully, your text file is a CSV or another format that can be rendered in Excel.

If that's the case, then put in your list of valid emails and bad emails in two columns (say... A and B) in excel... and use something like... =IF(ISNA(MATCH(A1,$B$1:$B$2700,0)),A1) in your output range.

You can then simply use Date->Remove Duplicates which will get rid of the "FALSE" instances as well as any duplicate email addresses in your output range.

Re: Remove the Content of 1 text file from another

Not tried it though: remove lines that contain words stored in a list

edit: gave it a try, not working too well.

Re: Remove the Content of 1 text file from another

Umar, that's very cool, but can this be done programatically? E.g. people send in unsubscribe requests and it gets deleted from the database. I guess the same priciple can be scheduled to run on a periodic basis, but I guess my question is in real time.

Re: Remove the Content of 1 text file from another

mirza have a linux computer make you life easy.

Re: Remove the Content of 1 text file from another

Actually you can do this in the windows environment too using the "findstr" command. Ofcourse the Grep utility has been ported over for win32 environment as well.
To find lines in a txt file with findstr you can use the following command:
"findstr /C:mirza_yasir4 *.txt"
This would find the string "mirza_yasir4" in all the txt files in the current folder.
Again you could "pipe" the results into a target text file using the ">" operative. There's tons of options for the "findstr" utility. Get the options using the "findstr /?" command.

PS: you can write a batch file which searches a txt files for all strings existing/not existing in a certain file. Sounds like a fun project.

Re: Remove the Content of 1 text file from another

This could be done in C++

I can do that, may be by spending 3,4 hours

I can do that also in VB, may be by spending 2 hours

But Why I do that, I have a lot other things to do in office...:D

Re: Remove the Content of 1 text file from another

May be it will take long time to switch over linux from windows...

later in my life I will do that, when I have much time.

Re: Remove the Content of 1 text file from another

This seems the right solution...

its quite amazing to see, here all type of experts are sitting... great I.T forum

Thanks brother

Re: Remove the Content of 1 text file from another

I spent about 30 mins on this yesterday evening. Simple problem, trivial to program but I did not manage to update the list with standard UNIX commands. Anyone done it?

Re: Remove the Content of 1 text file from another

Mr. Lucid Chaotic 's formula in excel did it in some way for me, Unix o I have no idea

Re: Remove the Content of 1 text file from another

You should be able to import the 2 files into access and use delete query

Re: Remove the Content of 1 text file from another

Well this is interesting too...

better if you write a generalized query here..

thanks

Re: Remove the Content of 1 text file from another

Tofi, a real time solution would indeed be the ideal... some sort of a mail server bounce filter to be integrated with a script to remove the email addresses from an address book or a mailing list.

Other options to do it programatically at the end-user level can be a VBA macro for Outlook if that's where the mailing list and filters reside.

The functionality is often included in hosted mass email solutions as a Hard Bounce Filter.

Re: Remove the Content of 1 text file from another

Yeah, I guess you just have to find the right mailer software. With my web hosting account in CPanel I get this Python powered mail list software which you can configure for soft and hard bounces.
On Windows I've used WorldMerge which has its list in Access format but the exclusion list is a plain text file which works but u need to do some manual insertions, which gets a bit cumbersome once the list starts getting bigger. I'll see if I can do that Access delete query.

Re: Remove the Content of 1 text file from another

Here is deleting from one table if data exists in another table:



delete from DispatchAreas where exists 
(Select area_id from JK_Dispatch_dallas where DispatchAreas.AreaID = JK_Dispatch_dallas.area_id);


Re: Remove the Content of 1 text file from another

I think another solution can be to use VLOOKUP in excel and finding the emails in one list that also exists in the other one. Later sorting them out and deleting the ones that you don't need.

The solution presented by Umer is almost the same thing, but just using a different approach.

Re: Remove the Content of 1 text file from another

Ever used "sed" ? ? ? ?

Re: Remove the Content of 1 text file from another

Use Unix/Linux command diff ... & grep for non-matching output & send that to a file & u will have all the unique email address .. excluding the ones u have in other file.

Assuming u have EMAIL1 file with all the bad email address, that also exist in the full email list known as EMAIL2 file. Than do the following

$ diff EMAILS1 EMAILS2 |grep @|sed 's/^< //' > UNIQUE_EMAILS

UNIQUE_EMAILS will have only email addresses that will not be in EMAIL1 file (aka all good email addresses)