Make sure both input files are sorted and UPPERCASE
Lines only in file1.txt
diff -d -i -w file1.txt file2.txt | grep "^[<]" > file1-only.txt
Lines only in file2.txt
diff -d -i -w file1.txt file2.txt | grep "^[>]" > file2-only.txt
Lines common in both files
diff -u -d -i -w file1.txt file2.txt | grep -v "^[-+]" > both-files.txt
