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?
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?
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