I am trying to use comm to compute the difference between two sorted files, however the result doesn’t make sense, what’s wrong? I want to show the strings that exists in test2 but not test1, and then show the strings that exist in test1 but not test2
>test1
a
b
d
g
>test2
e
g
k
p
>comm test1 test2
a
b
d
e
g
g
k
p
To show the lines that exist in
test2but not intest1, write either of these:(
-1hides the column with lines that exist only in the first file;-2hides the column with lines that exist only in the second file;-3hides the column with lines that exist in both files.)And, vice versa to show the lines that exist in
test1but not intest2.Note that
gon a line by itself is considered distinct fromgwith a space after it, which is why you getinstead of