com grep
e sem classificar arquivos:
$ (cat file2; grep -vf file2 file1) > output
----- ou -----
$ grep -vf file2 file1) >> file2 # append to end of file2
Com comm
e sort
:
$ (comm -12 <(sort file1) <(sort file2); comm -3 <(sort file1) <(sort file2) ) > output
comm -12 file1 file2 Print only lines present in both file1 and file2. comm -3 file1 file2 Print lines in file1 not in file2, and vice versa.
com sort
:
$ sort -u file{1,2} > output