Search

comm

The comm utility reads file1 and file2, which should be sorted lexically, and produces three text columns as output: lines only in file1; lines only in file2; and lines in both files.

usage: comm [-123i] file1 file2

Options for comm command:

  1. -1 :Suppress first column, lines unique to first file.
  2. -2 :Suppress second column, llines unique to second file.
  3. -3 :Suppress third column, llines common to both files.
  4. -i :Case insensitive comparison of lines.
comm -23i file1.txt file2.txt > lines_unique_to_first_file.txt