Compare 2 files and discard common lines

Mark mark at
Tue Jun 3 13:27:39 CEST 2008

On Thu, 29 May 2008 01:36:44 -0700, loial wrote:
> I have a requirement to compare 2 text files and write to a 3rd file
> only those lines that appear in the 2nd file but not in the 1st file.
> Rather than re-invent the wheel I am wondering if anyone has written
> anything already?

Of course you can do this at any linux or unix command line simply by:

comm -13 file1 file2 >file3

More information about the Python-list mailing list