Purpose: Selects or rejects lines common to two sorted files.
comm [ -1 -2 -3 ] File1 File2
Note: If you specify – (minus) for one of the file names, the comm command reads standard input.
The comm command reads the File1 and File2 parameters and writes, by default, a three-column output to standard output. The columns consist of:
Lines that are only in File1
Lines that are only in File2
Lines that are in both File1 and File2.
Both File1 and File2 should be sorted according to the collating sequence specified by the current National Language environment.
-1 Suppresses the display of the first column (lines in File1).
-2 Suppresses the display of the second column (lines in File2).
-3 Suppresses the display of the third column (lines common to File1 and File2).