From 2ec12a6854276ff738cbd06a87c68bb97e479868 Mon Sep 17 00:00:00 2001 From: Shawn Boyette Date: Wed, 4 Feb 2009 21:09:00 +0000 Subject: [PATCH] first whack --- extract_loadset | 34 ++++++++++++++++++++++++++-------- 1 files changed, 26 insertions(+), 8 deletions(-) diff --git a/extract_loadset b/extract_loadset index 4e3296e..b85ef19 100755 --- a/extract_loadset +++ b/extract_loadset @@ -8,13 +8,24 @@ use Getopt::Long; my $conf = {}; # configuration hashref initialize($conf); -open FP, '<', shift or die "Can't open input file: $!\n"; - +# build exclusion hash +open FP, '<', shift or die "Can't open matchset file: $!\n"; +my %exclude = (); while () { my ($lead,$sub) = split /\t/; - print $sub if $sub > 6999999) + $exclude{$sub} = 1 unless ($sub < $conf->{lowerbound}); +} +close FP; + +# strip exclusions from marcxml file +open MI, '<', $conf->{marc} or die "Can't open input file: $!\n"; +open MO, '>', $conf->{output} or die "Can't open output file: $!\n"; +while () { + m/tag="$conf->{tag}",+?(\d+){help}); + $conf->{tag} = $conf->{tag} || 903; + $conf->{subfield} = $conf->{subfield} || 'a'; + my @keys = keys %{$c}; show_help() unless (@ARGV and @keys); - for my $key ('output', 'filter') + for my $key ('output', 'lowerbound', 'input') { push @missing, $key unless $c->{$key} } if (@missing) { print "Required option: ", join(', ', @missing), " missing!\n"; @@ -42,10 +59,11 @@ sub initialize { sub show_help { print <