Re: Remove the Content of 1 text file from another
Excellent solution! :k: :k: - totally forgot about diff… arrggh! too much Windows for the last few years.
Re: Remove the Content of 1 text file from another
Excellent solution! :k: :k: - totally forgot about diff… arrggh! too much Windows for the last few years.
Re: Remove the Content of 1 text file from another
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)
Good stuff exactly what I was looking for. I had a play with diff but could not get it to work for me. Not really done much of UNIX scripting, do you mind explaining exactly what is happening in ^
Re: Remove the Content of 1 text file from another
Ya one thing I forgot to mention, the above command only works if u have one email address per one row (line).
**risc
**here is if the full demo, I just created for ur explanation.
EMAILS-A is the list of bad address, EMAILS-B is full list.
najim@freebsd ~ >> cat EMAILS-A (list of bad addresses)
[email protected]
[email protected]
[email protected]
najim@freebsd ~ >> cat EMAILS-B
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
najim@freebsd ~ >> diff EMAILS-A EMAILS-B
0a1,2
[email protected]
[email protected]
2a5
[email protected]
najim@freebsd ~ >> diff EMAILS-A EMAILS-B|grep @
[email protected]
[email protected]
[email protected]
najim@freebsd ~ >> diff EMAILS-A EMAILS-B|grep @|sed 's/^> //'
[email protected]
[email protected]
[email protected]
najim@freebsd ~ >> diff EMAILS-A EMAILS-B|grep @|sed 's/^> //' > UNIQUE_EMAILS
najim@freebsd ~ >> cat UNIQUE_EMAILS
[email protected]
[email protected]
[email protected]
Now u can see three bad emails are gone & only good ones are left.
Re: Remove the Content of 1 text file from another
Thanks :-)
Re: Remove the Content of 1 text file from another
if these files could be opened in excel then use the VLOOKUP function. :)