comm
The command that compares two sorted files and prints lines unique to the first, unique to the second and common to both, in three columns.
In more detail
Options -1, -2 and -3 hide those columns, so comm -13 shows only lines that appear in the second file alone. Both inputs must be sorted the same way first.
Example
comm -13 expected.txt <(sort -u actual.txt)Related terms
- diff — A listing of the differences between two versions of something, such as two files, two commits or two screenshots.
- sort command — The sort command, which puts lines in order, alphabetically by default.
- process substitution — The bash form <(command), which runs a command and hands its output to another program as if it were a file name.
Taught in
- Which Shell Am I In, And Getting Bash Five — Bash Scripting & Command Line Automation
- Pipelines, tee And Process Substitution — Bash Scripting & Command Line Automation
- Scheduling, Monitoring And A Script That Reports — Bash Scripting & Command Line Automation