Looking for recommendation on how to proceed.

Chris Hammond chris at tac.esi.net
Mon Aug 28 01:02:09 IST 2006


Oh my god!  I knew it would be simple!  I was trying to figure out how to do it with "sort | uniq" but it never crossed my mind to cat the first file to itself so that only the uniq files from the second file would be found.

Thanks for the reply, that is just what I needed and it is greatly appreciated.

Thanks
Chris
 
>>> "Glenn Steen" <glenn.steen at gmail.com> 08/27/06 5:25 PM >>> 
On 27/08/06, Chris Hammond <chris at tac.esi.net> wrote:
> I am trying to find the easiest way to compare two text files containing domain names and tell me which domain names in the second file do not exist in the first.  It seems like it should be a simple process but having no useful scripting knowledge, I am hoping someone can point me to something that already exists.
>
> Thanks
> Chris
>
Provided you have them 1 domain/line in the two files, it is very very simple:
total differences (you cat in file1 twice, so that it'll only be the
ones from file2 that pass out from "uniq":
cat file1 file1 file2 | sort | uniq - u
If you don't like that method, well... diff is our friend then:- ):
diff file1 file2 | egrep "^>"
... should do too:- ).
--  
--  Glenn
email: glenn < dot > steen < at > gmail < dot > com
work: glenn < dot > steen < at > ap1 < dot > se
--  
MailScanner mailing list
mailscanner at lists.mailscanner.info
http://lists.mailscanner.info/mailman/listinfo/mailscanner

Before posting, read http://wiki.mailscanner.info/posting

Support MailScanner development -  buy the book off the website! 

--  
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





More information about the MailScanner mailing list