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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityman 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