#lines which are exist only in file2: grep -Fxvf file1 file2 > file3 #lines which are exist only in file1: grep -Fxvf file2 file1 > file3 #lines which are exist in both files: grep -Fxf file1 file2 > file3