transfer correct marc into import file
[koha-eprints] / tsv2eprints.pl
index 7c9ea89..dec518b 100755 (executable)
@@ -130,8 +130,11 @@ while(<$tsv_fh>) {
 
                        $stat->{new}++;
 
-                       seek $marc_fh, $last_offset, 0;
-                       read $marc_fh, my $marc, $offset - $last_offset;
+                       seek $marc_fh, $offset, 0;
+                       read $marc_fh, my $marc_len, 5;
+                       seek $marc_fh, $offset, 0;
+
+                       read $marc_fh, my $marc, $marc_len;
                        print $import_fh $marc;
                        warn "# NEW ", join(' ', map { $row{$_} } qw(biblionumber title)), "\n";
 #                      warn "# NEW $biblionumber\n";
@@ -142,8 +145,6 @@ while(<$tsv_fh>) {
                $stat->{missing}++;
        }
 
-       $last_offset = $offset;
-
 }
 
 warn "# files left ", dump($files);