unsorted perl tools and snippets
[webpac] / tools / dump_marc.pl
1 #!/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 print "file '$file' with '",$x->marc_count(),"' records...\n";
12
13 while ($x->nextmarc(1)) {
14         print $x->output({format=>'ascii'});    # FIX
15
16         my $rec = $x->marc_count();
17         print $x->getfirstvalue({record=>$rec,field=>245,subfield=>'a',delimiter=>" "}),"<--\n";
18 }
19