1

Say I got:

aaa
bbb
ccc

and:

aaa
ccc
ddd

and I would like:

bbb

How would I get it?

John Lawrence Aspden
  • 17,124
  • 11
  • 67
  • 110

2 Answers2

2

Using grep -vf:

grep -vFxf file2 file1
bbb
anubhava
  • 761,203
  • 64
  • 569
  • 643
0

Please try below command:

comm is used for Compare sorted files FILE1 and FILE2 line-by-line.

-23 suppresses column 2 and 3.

$ comm -23 fil1.txt fil2.txt  
bbb
fedorqui
  • 275,237
  • 103
  • 548
  • 598
Ayyappa Boligala
  • 1,096
  • 7
  • 7