Select or reject lines common to two files (POSIX)
comm [-123] file1 file2
QNX Neutrino
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 |
Print only the lines common to both files:
comm -12 test.dat save.dat
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.