1 |
dpavlin |
61 |
#!/usr/bin/perl -w |
2 |
|
|
|
3 |
|
|
use strict; |
4 |
|
|
use MARC; |
5 |
|
|
|
6 |
|
|
my $file = shift @ARGV || die "Usage: $0 [marc file]"; |
7 |
|
|
|
8 |
|
|
my $x = new MARC; |
9 |
|
|
my $nr = $x->openmarc( { file => $file, format => 'usmarc' }); |
10 |
|
|
|
11 |
dpavlin |
209 |
# read MARC file in memory |
12 |
|
|
$x->nextmarc(-1); |
13 |
|
|
|
14 |
|
|
my $max_rec = $x->marc_count(); |
15 |
|
|
|
16 |
dpavlin |
61 |
print "file '$file' with '",$x->marc_count(),"' records...\n"; |
17 |
|
|
|
18 |
dpavlin |
209 |
for(my $i=1; $i<=$max_rec; $i++) { |
19 |
|
|
print "REC #$i: ",$x->getfirstvalue({record=>$i,field=>245,subfield=>'a',delimiter=>" "}),"\n"; |
20 |
|
|
print $x->output({format=>'ascii', record=>$i}); |
21 |
dpavlin |
61 |
} |
22 |
|
|
|