Content-type: text/html
comm - Compares two sorted files.
comm [-123] file1 file2
Suppresses output of the first column (lines in file1 only). Suppresses output of the second column (lines in file2 only). Suppresses output of the third column (lines common to file1 and file2).
The command
comm
-123
produces no
output.
The comm command reads file1 and file2 and writes three columns to standard output, showing which lines are common to the files and which are unique to each.
The leftmost column of standard output includes lines that are in file1 only. The middle column includes lines that are in file2 only. The rightmost column includes lines that are in both file1 and file2.
If you specify a hyphen (-) in place of one of the file names, comm reads standard input.
Generally,
file1
and
file2
are sorted according to the collating sequence specified by the
LC_COLLATE
environment variable. (See
sort(1).)
Successful completion.
Error occurred.
In the following examples, file1 contains the following sorted list of North American cities:
Anaheim
Atlanta
Baltimore
Boston
Cincinnati
Cleveland
Dallas
Detroit
Houston
Kansas City
Los Angeles
Milwaukee
Minneapolis
Montreal
Oakland
Philadelphia
Pittsburgh
San Diego
San Francisco
Seattle
St. Louis
Toronto
Atlanta Cincinnati Houston Los Angeles Montreal Philadelphia Pittsburgh San Diego San Francisco St. Louis
Chicago New York
Commands: cmp(1), diff(1), sdiff(1), sort(1), uniq(1)