for i in `comm -12 1.txt 2.txt`; do sed -i '' "/^$i\$/d" 1.txt; sed -i '' "/^$i\$/d" 2.txt; done
-f FILE, --file=FILE
Obtain patterns from FILE, one per line. The empty file contains zero patterns, and therefore matches nothing. (-f is specified by POSIX.)
-v, --invert-match
Invert the sense of matching, to select non-matching lines. (-v is specified by POSIX.)