SUMMARY: difference between two files
Rich Glazier <[email protected]> Tue, 08 Jun 2010 15:07:53 -0700 (PDT)
| Newsgroups | gmane.os.tru64.managers |
|---|---|
| Message-ID | <[email protected]> |
Thanks to all the responses I got. The one I went with was to sort and uniq= the the files, and then compare them using 'comm'.=0A=0Asort -u file1 > fi= le1.sorted=0Asort -u file2 > file2.sorted=0Acomm -13 file1.sorted file2.sor= ted=0A=0AThe '1' flag for comm says 'suppress lines unique to FILE1'=0AThe = '3' flag for comm says 'suppress lines that appear in both files'=0A=0ASinc= e I only cared about what was in file2 that wasn't in file1, these options = worked.=A0 In my example below the "1" option wouldn't really=A0be necessar= y because there's nothing in file1 that isn't in file2, but for my real wor= ld files this covered both lines only in file1 and also lines both in file1= and file2. Or in-other-words, lines only in file2 that aren't in file1.=0A= =0A=0A=0A----- Original Message ----=0AFrom: Rich Glazier <rglazier2002@yah= oo.com>=0ATo: [email protected]=0ASent: Mon, June 7, 2010 12:21:= 52 PM=0ASubject: difference between two files=0A=0AI have two files somethi= ng like this:=0A=0Afile 1=0A-------=0A1=0A2=0A4=0A5=0A6=0A8=0A9=0A=0Afile2= =0A-----=0A1=0A2=0A3=0A4=0A5=0A6=0A7=0A8=0A9=0A=0Ai want to strip out only = what's different in file 2 from file 1.=A0 the output would only be 3 and 7= .=A0 i've tried using diff, sort, uniq, and comm but can't quite seem to ge= t what i need.=0A=0Aany thoughts?=0A=0Athanks!!=0A=0A-Rich=0A=0A=0A