On 12/8/2012 2:01 AM, Roy Fulbright wrote:
The easiest way I found to calculate and display the delta of lines
that differ is to write a short Perl program:
#!/usr/bin/perl
use strict;
use warnings;
my $file1 = "diff1.txt";
my $file2 = "diff2.txt";
open(my $fh1,'<', $file1) or die "Error opening $file1: $!\n";
open(my $fh2,'<', $file2) or die "Error opening $file2: $!\n";
while ( !eof($fh1) && !eof($fh2) ) {
my $t1 = <$fh1>;
my $t2 = <$fh2>;
chomp $t1;
chomp $t2;
if ($t1 ne $t2) {
my ($p1,$b1) = $t1 =~ /(\d+).*?(\d+)/;
my ($p2,$b2) = $t2 =~ /(\d+).*?(\d+)/;
my $pdelta = $p2 - $p1;
my $bdelta = $b2 - $b1;
print pack("A42",$t1), pack("A42",$t2), "$pdelta $bdelta\n";
}
}
Many thanks Roy!
this remind me that external tool can be used/created here but still
called from inside vim if one (I) is not capable of making complex vim
script...
regards
ping
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php