Text Processing

comm

Compares two sorted files line by line.

comm shows lines unique to the first file, unique to the second file, and common to both.

Syntax
comm [options] file1 file2

Arguments explained

  • Options adjust output or behavior.
  • Arguments name the files, services, hosts, or values the command should work with.

Common examples

Show common lines only
comm -12 <(sort a.txt) <(sort b.txt)

Suppresses unique columns and prints shared lines.

Compare sorted lists
comm old.txt new.txt

Shows three comparison columns.

comm Command
FieldDetails
Commandcomm
CategoryText Processing
Primary useCompares two sorted files line by line.
Syntaxcomm [options] file1 file2