0

man diff says:

diff - compare files line by line

So diff will compare the files. However, eventually, it will show the difference, if there is any. How can I compare the files and show the matching parts?

finefoot
  • 2,940
  • 2
  • 21
  • 41

1 Answers1

1

Output format of diff can be controlled , so for you case , you must 3 options :

diff --old-group-format='' --new-group-format=''  \
     --unchanged-group-format='%=' a.txt  b.txt 

the man diff is not useful better read info diff

or use comm

EchoMike444
  • 3,045
  • 1
  • 11
  • 14