I have two long, but sorted files. How to get all lines of first file which are not in second file ?
file1
0000_aaa_b
0001_bccc_b
0002_bcc <------ file2 have not that line
0003_aaa_d
0006_xxx
...
file2
0000_aaa_b
0001_bccc_b
0003_aaa_d
0006_xxx
...
Just run a
diff
on them:The
-c
(for "context") flag will only display the lines that are different, with two lines surrounding each line.This is what the
comm
command is for:From
man comm
: