comm
Quick Reference
Command Name:
comm
Category:
file comparison
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
- 1
Set operations
Perform set operations on sorted files
- 2
Data analysis
Analyze common and unique lines between files
- 3
File merging
Identify common lines for file merging operations
- 4
Data deduplication
Find duplicate lines across multiple files
Syntax
comm [OPTION]... FILE1 FILE2
Options
Option | Description |
---|---|
-1 |
Suppress lines unique to FILE1 |
-2 |
Suppress lines unique to FILE2 |
-3 |
Suppress lines that appear in both files |
--check-order |
Check that the input is correctly sorted, even if all input lines are pairable |
--nocheck-order |
Do not check that the input is correctly sorted |
--output-delimiter=STR |
Separate columns with STR |
--total |
Output a summary |
-z, --zero-terminated |
Line delimiter is NUL, not newline |
--help |
Display help message and exit |
--version |
Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the comm
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
comm file1.txt file2.txt
comm -23 file1.txt file2.txt
comm -13 file1.txt file2.txt
comm -12 file1.txt file2.txt