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.
Best Answer
How about using diff, even though you don't want a diff? Try this:
Here is what I get with your sample data: