Diff is a great tool to display the changes between two files. But how to display the similarities of two text files (while ignoring the differences)?
I.e. sample input:
a:
Foo Bar
X
Hello
World
42
b:
Foo Baz
Hello
World
23
Pseudo output (something like this):
@@ 2,3
=Hello World
Just sorting both files and using comm is not enough, because in that case the line information is lost.
Hello World Mars Venus
in your output originated on one line--or up to 4 different lines.Hello
appears identically on four duplicated lines in each input file, do you wantHello
to appear four times in your output?