in reply to Comparing the contents of two files

There's a standard POSIX utility that does that: comm. It assumes your files are sorted (but if not, that's easy to do). In bash, you can write:
comm <(sort file1) <(sort file2)
and it prints three columns, one with lines only in file1, one with lines only in file2, and one with lines in both files.