upsc-log-diff: +$line
authorJan Kratochvil <jan@jankratochvil.net>
Mon, 21 Jun 2021 12:15:09 +0000 (14:15 +0200)
committerJan Kratochvil <jan@jankratochvil.net>
Mon, 21 Jun 2021 12:15:09 +0000 (14:15 +0200)
bin/upsc-log-diff

index 6c21015..7ca44e3 100755 (executable)
@@ -12,7 +12,9 @@ my $F="/var/log/upsc.log";
 open F,$F or die "$F: $!";
 my $prev;
 my $this="";
 open F,$F or die "$F: $!";
 my $prev;
 my $this="";
+my $line;
 while (<F>) {
 while (<F>) {
+  $line=$.;
   chomp;
   if (!/^$/) {
     $this.="$_\n";
   chomp;
   if (!/^$/) {
     $this.="$_\n";
@@ -30,8 +32,8 @@ while (<F>) {
     local *TD;
     my $td="diff -u $ta $tb|";
     open TD,$td or die "$td: $!";
     local *TD;
     my $td="diff -u $ta $tb|";
     open TD,$td or die "$td: $!";
-    <TD>=~/^\Q--- / or die $_;
-    <TD>=~/^\Q+++ / or die $_;
+    <TD>=~/^\Q--- / or die "line $line: $_";
+    <TD>=~/^\Q+++ / or die "line $line: $_";
     while (<TD>) {
       next if /^[@ ]/;
       print;
     while (<TD>) {
       next if /^[@ ]/;
       print;