How can I extract differences between 2 folders ?

Matthew Seaman m.seaman at infracaninophile.co.uk
Tue May 5 20:20:16 UTC 2009


Polytropon wrote:
> On Tue, 5 May 2009 21:35:22 +0300, Yavuz Maşlak <yavuz.maslak at netiletisim.net> wrote:

>> I wish diff or another command not to display same values which are in 
>> different lines.
> 
> You could first run the files through sort, then diff them.

Rather than diff(1), perhaps comm(1) is a better choice.  You still need to
sort the input files though:

   % sort file1 > file1.sorted
   % sort file2 > file2.sorted
   % comm -3 file1.sorted file2.sorted

This will print two columns of output.  The first column consists of lines
that are only in file1, and the second of lines that are only in file2.

	Cheers,

	Matthew


-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090505/57d342ba/signature-0001.pgp


More information about the freebsd-questions mailing list