The efficiency of file processing in Linux environment has a strong positive correlation to how large your brain capacity is to remember common commands. So I write down commands to release brain space.
Intersection of records:
grep -F -f a.txt b.txt | sort | uniq
Subtraction of records:
grep -F -v -f a.txt b.txt | sort | uniq # or: grep -F -v -f b.txt a.txt | sort | uniq