How to display only different rows using diff (bash)

a.txt:

1;john;125;3
1;tom;56;2
2;jack;10;5

b.txt:

1;john;125;3
1;tom;58;2
2;jack;10;5

Use comm:

comm -13 a.txt b.txt 
1;tom;58;2

The command line options to comm are pretty straight-forward:

-1 suppress column 1 (lines unique to FILE1)

-2 suppress column 2 (lines unique to FILE2)

-3 suppress column 3 (lines that appear in both files)

Leave a Comment