Compare Two Text Files

Refer: https://stackoverflow.com/questions/746458/how-to-show-lines-in-common-reverse-diff" href="https://stackoverflow.com/questions/746458/how-to-show-lines-in-common-reverse-diff">https://stackoverflow.com/questions/746458/how-to-show-lines-in-common-reverse-diff

comm -1 -2 file1.sorted file2.sorted

where file1 and file2 are sorted and piped into *.sorted

Here's the full usage of comm:

comm [-1] [-2] [-3 ] file1 file2
-1 Suppress the output column of lines unique to file1
-2 Suppress the output column of lines unique to file2
-3 Suppress the output column of lines duplicated in file1 and file2

The comm command (short for "common") may be useful comm - compare two sorted files line by line

find lines only in file1

comm -23 file1 file2

find lines only in file2

comm -13 file1 file2

find lines common to both files

comm -12 file1 file2

The man file is actually quite readable for this.

comm -23 OLCI_K229.csv OLCI_EDOCS.csv