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?

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

  • Aaah, I always forget about info for GNU tools – finefoot Nov 5 '19 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.