comm

Select or reject lines common to two files (POSIX)

Syntax:

comm [-123] file1 file2

Runs on:

QNX Neutrino

Options:

-1
(“One”) Suppress the writing of lines found only in file1.
-2
Suppress the writing of lines found only in file2.
-3
Suppress the writing of lines found in both file1 and file2.
file1
The pathname of the first file to be compared. If file1 is -, standard input is used.
file2
The pathname of the second file to be compared. If file2 is -, standard input is used.

Description:

The comm utility reads file1 and file2, which must be ordered in collating sequence (see the sort utility), and produces three text columns as output.

This column: Contains:
1 Lines found only in file1
2 Lines found only in file2
3 Lines found in both files

Examples:

Print only the lines common to both files:

comm -12 test.dat save.dat

Files:

Standard input is used only if specified as a dash (-) command-line file parameter.

All input files must be text files for comm to produce a meaningful result.

The results of the comparison are written to standard output.

If any errors occur, comm writes diagnostic messages to standard error.

Exit status:

0
All input files were successfully output as specified.
>0
An error occurred.