1 |
dpavlin |
10 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
use warnings; |
4 |
|
|
use strict; |
5 |
|
|
|
6 |
|
|
use MARC::Fast; |
7 |
|
|
use Data::Dump qw/dump/; |
8 |
|
|
|
9 |
|
|
my ( $file, $debug ) = @ARGV; |
10 |
|
|
|
11 |
|
|
my @skip = qw( |
12 |
|
|
00019784 |
13 |
|
|
00026677 |
14 |
|
|
); |
15 |
|
|
|
16 |
|
|
my $marc = new MARC::Fast( |
17 |
|
|
marcdb => $file, |
18 |
|
|
debug => $debug, |
19 |
|
|
); |
20 |
|
|
|
21 |
|
|
my $skip_pos = 0; |
22 |
|
|
|
23 |
|
|
for my $mfn ( 1 .. $marc->count ) { |
24 |
|
|
my $rec = $marc->fetch($mfn) || next; |
25 |
|
|
|
26 |
|
|
my $tsv = "rec\t$mfn\tleader\t", $marc->last_leader, "\t"; |
27 |
|
|
my $ascii = $marc->to_ascii($mfn); |
28 |
|
|
$ascii =~ s{\n}{\t}gs; |
29 |
|
|
$ascii =~ s{[\x00- ]}{ }gs; |
30 |
|
|
$tsv .= $ascii; |
31 |
|
|
print "$tsv\n"; |
32 |
|
|
warn dump($marc->to_hash($mfn, include_subfields => 1)) if $debug; |
33 |
|
|
} |