X-Git-Url: http://git.rot13.org/?p=MARC-Fast;a=blobdiff_plain;f=scripts%2Fdump_fastmarc.pl;h=efce95487f2d964b3efefe6da4ac133470c52715;hp=eb0fd0cd0d00acb0c9decc5b8100c5bd61cd44b3;hb=3d844dfbf091bc62a45aff80189d402d1f9cba1f;hpb=1eb9ffc53258d90a524ef05e88d9321c042def92 diff --git a/scripts/dump_fastmarc.pl b/scripts/dump_fastmarc.pl index eb0fd0c..efce954 100755 --- a/scripts/dump_fastmarc.pl +++ b/scripts/dump_fastmarc.pl @@ -19,13 +19,13 @@ dump_fastmarc.pl - display MARC records =over 16 -=item -n number +=item -o offset -dump just record C +dump records starting with C =item -l limit -import just first C records +dump just C records =item -h @@ -40,9 +40,9 @@ turn debugging output on =cut my %opt; -getopts('dn:l:h', \%opt); +getopts('do:l:h', \%opt); -my $file = shift @ARGV || die "usage: $0 [-n number] [-l limit] [-h] [-d] file.marc\n"; +my $file = shift @ARGV || die "usage: $0 [-o offset] [-l limit] [-h] [-d] file.marc\n"; my $marc = new MARC::Fast( marcdb => $file, @@ -67,12 +67,7 @@ for my $mfn ($min .. $max) { my $rec = $marc->fetch($mfn) || next; print "rec is ",Dumper($rec) if ($opt{d}); print "REC $mfn\n"; - foreach my $f (sort keys %{$rec}) { - my $dump = join('', @{ $rec->{$f} }); - $dump =~ s/\x1e$//; - $dump =~ s/\x1f/\$/g; - print "$f\t$dump\n"; - } - print "\n"; - print "hash is ",Dumper($marc->to_hash($mfn)) if ($opt{h}); + print $marc->last_leader,"\n"; + print $marc->to_ascii($mfn),"\n"; + print "hash is ",Dumper($marc->to_hash($mfn, include_subfields => 1)) if ($opt{h}); }