How can I extract differences between 2 folders ?

Matthew Seaman m.seaman at
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> 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.



Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP:     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 :

More information about the freebsd-questions mailing list