$comm sorta.txt sortb.txt
d
g
comm: file 1 is not in sorted order
e
s
x
comm: file 2 is not in sorted order
g
s
n
$cat sorta.txt
d
g
e
s
$cat sortb.txt
x
g
s
n
$
$cat sorta.txt
a
b
c
d
$cat sortb.txt
a
f
g
h
$comm sorta.txt sortb.txt
a
b
c
d
f
g
h
$
comm - compare two sorted files line by line
With no options, produce three-column output.
Column one contains lines unique to FILE1, column
two contains lines unique to FILE2, and column three
contains lines common to both files.
Reference/Source :
Debian manual for command "comm".