Compare two sorted files line by line.
Synopsis
comm [OPTION]... FILE1 FILE2
Description
Reads FILE1 and FILE2, which should be sorted, and produces three columns: lines only in FILE1, lines only in FILE2, and lines in both.
Options
-1 Suppress column 1 (lines unique to FILE1).
-2 Suppress column 2 (lines unique to FILE2).
-3 Suppress column 3 (lines that appear in both files).
--help Display help and exit.
Examples
$ comm a.txt b.txt
Show lines unique to each file and lines common to both.
$ comm -12 a.txt b.txt
Show only lines common to both files.
Notes
Inputs must already be sorted (see sort) for correct results.
See Also
diff, sort, join, uniq