Friday, September 13, 2019

Compare two files


MAKE sure you sort the files first
sort file_unsorted > file1
sort file_unsorted2 > 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