Looking for recommendation on how to proceed.

Chris Hammond chris at tac.esi.net
Mon Aug 28 14:49:02 IST 2006


Hmm.  I'm surprised I didn't find that utility in my travels.  Thanks for pointing this one out.

Thanks
Chris
 
>>> Jethro R Binks <jethro.binks at strath.ac.uk> 08/28/06 8:58 AM >>> 
On Sun, 27 Aug 2006, Chris Hammond wrote:

> 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.

Even simpler is to use the tool designed for the job, "comm".

DESCRIPTION
     The comm utility reads file1 and file2, which should be sorted lexically,
     and produces three text columns as output: lines only in file1; lines
     only in file2; and lines in both files.


> >>> "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

Jethro.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Jethro R Binks
Computing Officer, IT Services
University Of Strathclyde, Glasgow, UK
--  
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