forked from beheerderdag/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_marc.pl
More file actions
45 lines (30 loc) · 735 Bytes
/
Copy pathread_marc.pl
File metadata and controls
45 lines (30 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl -w
# reading enchanced MARC file
use strict;
use MARC::File::USMARC;
my $filename="file.mrc";
# create a new marc objec to read the file
my $file = MARC::File::USMARC->in( $filename );
my $issn;
# read the marc file with all the MARC records
while ( my $marc = $file->next() ) {
#print $marc->as_formatted, "\n\n" ;
if ($marc->field('700')) {
$issn = $marc->field('700')->subfield("a");
}
my $url;
if($marc->field('856')) {
$url = $marc->field('856')->subfield("u");
}
if ($sub2) {
$title = "$title: $sub2" ;
}
else
{
$title = $title;
}
print "$title\t$isbn\t$url\t$author\n";
#print "$title\n";
}
$file->close();
undef $file;