comm – Select or reject lines common to two files

Syntax

comm {option} file_1 file_2

The comm utility reads file_1 and file_2, which should be sorted lexically, and produces three text columns as output: lines only in file_1, lines only in file_2 and lines in both files.

Options

-1
Suppress printing of column 1, i.e. the lines only in file_1.
-2
Suppress printing of column 2, i.e. the lines only in file_2.
-3
Suppress printing of column 3, i.e. the lines common to both.
-i
Case insensitive comparison of lines.

Further information

man comm


2022-07-01