Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- print('<?xml version="1.0" encoding="utf-8"?>' . "\n");
- print('<collection xmlns="http://www.loc.gov/MARC21/slim">' . "\n");
- my ($f, $fh);
- $f = 1;
- $fh = undef;
- my $fp = "/home/jason/Src/evergreen/migration/trunk-hg/data/biblio.record_entry.%03d.file";
- my $bib;
- while ($bib = <::DATA>) {
- my $notfound = 1;
- chomp $bib;
- do {
- open($fh, sprintf($fp, $f++)) if (!defined($fh));
- my $line = <$fh>;
- if ($line) {
- if ($line =~/^$bib\t/) {
- my $record;
- $record = $1 if ($line =~ /(<record.*<\/record>)/);
- $record =~ s/ xmlns=\"[^\"]+\"//;
- print $record . "\n";
- $notfound = 0;
- }
- }
- else {
- close($fh);
- $fh = undef;
- }
- } while ($notfound);
- }
- close($fh) if (defined($fh));
- print("</collection>\n");
- __DATA__
- 67759
- 207758
- 365138
- 398759
- 459563
- 840678
- 1086637
- 1096224
- 1130908
- 1239723
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement