Common – compare two sorted files line by line and write to standard output:
the lines that are common, plus the lines that are unique.

comm [options]… File1 File2

-1 suppress lines unique to file1
-2 suppress lines unique to file2
-3 suppress lines that appear in both files

A file name of &qt;-&qt;&qt; means standard input.Before &qt;comm&qt;&qt; can be used, the input files must be sorted using the collating sequence specified by the &qt;LC_COLLATE&qt;&qt; locale, with trailing newlines significant. If an input file ends in a non-newline character, a newline is silently appended. The &qt;sort&qt;&qt; command with no options always outputs a file that is suitable input to &qt;comm&qt;&qt;.

With no options, &qt;comm&qt;&qt; produces three column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to both files. Columns are separated by a single TAB character.

The options &qt;-1&qt;&qt;, &qt;-2&qt;&qt;, and &qt;-3&qt;&qt; suppress printing of the corresponding columns.

Unlike some other comparison utilities, &qt;comm&qt;&qt; has an exit status that does not depend on the result of the comparison. Upon normal completion &qt;comm&qt;&qt; produces an exit code of zero. If there is an error it exits with nonzero status.