Comm

Combine lines from two sorted files

$ comm file1 file2

Prints these three columns:

  1. Lines unique to file1
  2. Lines unique to file2
  3. Lines both in file1 and file2

With options -1, -2, -3, you can remove each of these columns