comm

Show common and unique lines between two sorted files

Usage: comm file1 file2

Standard Input: Only used if file1 or file2 is a dash (–)

Standard Output: Used to display results col 1 shows lines only in file1.

col 2 shows lines only in file2.

col 3 shows lines in common.

SEE ALSO

For more information, see page 261

Useful options:

-1 means suppress col 1 (lines only in file1).

-2 means suppress col 2 (lines only in file2).

-3 means suppress col 3 (common lines).

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.