This command joinwill do what you ask for:
join -v 1 fileA fileB > fileC
Demonstration:
$ cat fileA
a
c
d
g
h
t
u
v
z
$ cat fileB
a
d
g
t
u
z
$ join -v 1 fileA fileB
c
h
v
This involves sorting the files as you indicated in your question. For unsorted files:
join -v 1 <(sort fileA) <(sort fileB)
source
share