8 my $conf = {}; # configuration hashref
11 # build exclusion hash
12 open FP, '<', shift or die "Can't open matchset file: $!\n";
15 my ($lead,$sub) = split /\t/;
16 $exclude{$sub} = 1 unless ($sub < $conf->{lowerbound});
20 # strip exclusions from marcxml file
21 open MI, '<', $conf->{marc} or die "Can't open input file: $!\n";
22 open MO, '>', $conf->{output} or die "Can't open output file: $!\n";
24 m/tag="$conf->{tag}",+?<subfield code="$conf->{subfield}">(\d+)</
25 print MO unless $exclude{$1};
33 # set mode on existing filehandles
34 binmode(STDIN, ':utf8');
36 my $rc = GetOptions( $c,
44 show_help() unless $rc;
45 show_help() if ($c->{help});
47 $conf->{tag} = $conf->{tag} || 903;
48 $conf->{subfield} = $conf->{subfield} || 'a';
50 my @keys = keys %{$c};
51 show_help() unless (@ARGV and @keys);
52 for my $key ('output', 'lowerbound', 'input')
53 { push @missing, $key unless $c->{$key} }
55 print "Required option: ", join(', ', @missing), " missing!\n";
62 Usage is: extract_loadset -l BOUND -i MARC -o OUTPUT MATCHSET
64 --lowerbound -l Lowest record ID which will be included in the loadset
65 --input -i MARCXML input file
66 --output -o MARCXML output file