comm -23 x1.txt x2.txt

Category: Data Science & Analysis

comm -23 x1.txt x2.txt

Show lines present only in the first file

comm compares two sorted files and prints three columns: lines only in file 1, only in file 2, and common to both. The flags -2 and -3 suppress the second and third columns, leaving just the lines unique to x1.txt. Both inputs must be sorted first, or results are wrong. This is the standard way to diff two sorted lists for missing entries.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.