(I'm running into this in a context of using vimdiff, which relies on and interprets the output of diff, so I think this is a diff question.)
Given these files, the first having 2 lines, the second having 4, diff (GNU 3.3) shows the complete files.
< 09/02/2014 | CFCU Checking | PAYPAL | 12.99 | | 12.99
< 09/03/2014 | CFCU Checking | PAYPAL | 24.45 | | 37.44
---
> 09/02/2014 | Expenses : Advertising | Closed | | 12.99 | 12.99
> 09/02/2014 | CFCU Checking | PAYPAL | 12.99 | | 0.00
> 09/03/2014 | Expenses : Advertising | Closed | | 24.45 | 24.45
> 09/03/2014 | CFCU Checking | PAYPAL | 24.45 | | 0.00
This makes vimdiff see there as being virtually no shared content. As shown in the top of the picture below, it shows matching the first 13 characters on line 1, the first 4 on line 2, and sees lines 3 and 4 as new.
I spend a lot of time in this situation adding newlines in place of the inserted lines, to force diff (and in turn vimdiff) to show it as the middle of the picture below.
Is there a way to make diff to break this up better, so vimdiff would see it as the bottom of the picture? (Which I Photoshoped.)
It would need 4 sections rather than the 1 shown above. Something like:
#,#c#,#
---
> 09/02/2014 | Expenses : Advertising | Closed | | 12.99 | 12.99
#,#c#,#
< 09/02/2014 | CFCU Checking | PAYPAL | 12.99 | | 12.99
---
> 09/02/2014 | CFCU Checking | PAYPAL | 12.99 | | 0.00
#,#c#,#
---
> 09/03/2014 | Expenses : Advertising | Closed | | 24.45 | 24.45
#,#c#,#
< 09/03/2014 | CFCU Checking | PAYPAL | 24.45 | | 37.44
---
> 09/03/2014 | CFCU Checking | PAYPAL | 24.45 | | 0.00
By the way, vimdiff can use different diff options, through diffexpr
, but requires default (I think called ed
) style diffs.
So, I think what I'm looking for is a way to make diff not mixing a changed line and an inserted line in the same section.