Thinking of using diff? Try comm, its sole purpose is to compare 2 sorted files line by line.
Show lines in A.txt but NOT in B.txt:
comm -2 -3 A.txt B.txtIf the files aren’t sorted, use:
comm -2 -3 <(sort A.txt) <(sort B.txt) Show lines in B.txt but NOT in A.txt:
comm -2 -3 B.txt A.txt BONUS: Show lines in both files (UNION):
comm -1 A.txt B.txt