Ken Bloom
Ken Bloom

Reputation: 58790

Diff tool to align shuffled lines

Suppose I have two documents that are identical except the lines are shuffled. Is there a tool that can show me which lines in document A correspond to which lines on document B by drawing lines to connect them (kinda like Cairo does for machine translation word alignments)?

What if the files have some level of differing lines (I don't want to figure out which lines are similar to each other -- if there isn't an exact match for a line, then that line has no match.)

Note: I am not looking to sort the files and compare them, rather I am looking to get a visualization of how far out of order the files are relative to each other, and which particular regions tend to move together, and which tend to be shuffled.

Upvotes: 1

Views: 1535

Answers (2)

Ken Bloom
Ken Bloom

Reputation: 58790

I just discovered psame in a google search which (at least algorithmically) does the same thing.

Upvotes: 0

i_am_jorf
i_am_jorf

Reputation: 54610

Windiff will show you the line in the left file it thinks the line in the right file came from, but it's often mistaken when lines are the same (e.g. a line with just a } in a cc file).

Upvotes: 2

Related Questions