comm
Options
-1
-
comm-help-column-1
-2
-
comm-help-column-2
-3
-
comm-help-column-3
--output-delimiter=<STR>
-
comm-help-delimiter
--zero-terminated
,-z
-
comm-help-zero-terminated
--total
-
comm-help-total
--check-order
-
comm-help-check-order
--nocheck-order
-
comm-help-no-check-order
Examples
Produce three tab-separated columns: lines only in first file, lines only in second file and common lines:
comm {{file1}} {{file2}}
Print only lines common to both files:
comm -12 {{file1}} {{file2}}
Print only lines common to both files, reading one file from stdin
:
cat {{file1}} | comm -12 - {{file2}}
Get lines only found in first file, saving the result to a third file:
comm -23 {{file1}} {{file2}} > {{file1_only}}
Print lines only found in second file, when the files aren't sorted:
comm -13 <(sort {{file1}}) <(sort {{file2}})
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.