I know how to use comm
, diff
or grep
to display every common line of two files. But how can I display only the largest common part, i. e. the most common lines in succession?
(If there are equally large common parts, I feel indifferent about which part will be displayed. Doesn't matter if first, last or undefined behavior. In my case, the largest common part will always be significantly larger than any other common part.)
Example:
A
B
C
D
E
F
G
A
X
D
E
F
B
C
Common parts are A
, BC
and DEF
. The largest common part I'm looking for is DEF
with 3 lines in comparison to A
and BC
with only 1 line and 2 lines.
diff
for a possible tool. 1000 works. Even 10,000.