Reputation: 303
There is a file1
and another file file2
, then my solution to get the union file of file1
and file2
is:
step: get the intersection set file
comm -1 -2 file1 file2 >>intersectionFile
step: get the complement set file of file1
comm -1 -3 file1 file2 >> file1ComplementFile
step: get the complement set file of file2
comm -2 -3 file1 file2 >> file2ComplementFile
step: get the union set file equals the intersection set file PLUS file1
's complement set file PLUS file2
's complement set file
cat intersectionFile file1ComplementFile file2ComplementFile >> unionFile
MY QUESTION IS is there a better OR easier way to get the union file of file1
and file2
?
Upvotes: 0
Views: 2887
Reputation: 18864
Your manipulations are identical to just comm file1 file2 >unionFile
. Can you try just that?
Upvotes: 1