};
-open(my $tsv_fh, '<:encoding(UTF-8)', "$koha_path.tsv");
-open(my $tsv_marc, '<:encoding(UTF-8)', "$koha_path.marc");
+open(my $tsv_fh, '<:encoding(UTF-8)', "$koha_path.tsv");
+open(my $marc_fh, '<', "$koha_path.marc");
+open(my $import_fh, '>', "$koha_path.import.marc");
+
+my $last_offset = 0;
while(<$tsv_fh>) {
my $line = $_;
if ( $item->{full_path} = $files->{$biblionumber} ) {
$stat->{file}++;
+
+ seek $marc_fh, $last_offset, 0;
+ read $marc_fh, my $marc, $offset - $last_offset;
+ print $import_fh $marc;
+ warn "# marc $biblionumber $title\n";
+
} else {
$stat->{missing}++;
}
+ $last_offset = $offset;
+
}
print qq{