paulfitz / daff

align and compare tables
https://paulfitz.github.io/daff
MIT License
790 stars 68 forks source link

Show row number or fixed column in diff #180

Open watho opened 2 years ago

watho commented 2 years ago

Hi,

is it possible to always show a column in the diff? I am comparing excel sheets with 10.000 rows and more and need the line number for context. Otherwise it is impossible to know where the difference inside the sheet is.

paulfitz commented 2 years ago

Do you have a lot of columns @watho? If not too many --all-columns might be adequate - it will turn off pruning of unchanged columns.

watho commented 2 years ago

Yes, over 50. That's not an option.

Thx for the quick answer.

paulfitz commented 2 years ago

Hmm it has been a while since I looked at this, but I'd have expected the leftmost columns to be shown by default. Is line number an explicit column in your diff? If not, the --index flag may be what you are looking for, it makes the row and column mappings explicit, and the row mappings include corresponding row numbers in the two tables:

$ daff --index data.csv data2.csv
@:@,   ,A:A,B:B,...,I:I,J:J
   ,@@ ,a  ,b  ,...,i  ,j
   ,...,...,...,...,...,...
2:2,   ,101,2  ,...,9  ,10
3:3,→  ,103,2  ,...,9  ,10→100
watho commented 2 years ago

Somehow i missed this option and created my own rownumber column. Looking at the code the --index flag correspondents to the flag always_show_order on CompareFlags, right? I will try this.