From: Galen Charlton Date: Tue, 7 Aug 2012 18:09:37 +0000 (-0400) Subject: add --reverse option to extract_loadset X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=d10d13ffea1f2d6faeaaab789ebb1e690611d3d4 add --reverse option to extract_loadset When supplied, output will contain the subordinate bibs rather than the lead bibs. This can be useful for getting the subordinate bibs in a separate file for field-level merging. Signed-off-by: Galen Charlton --- diff --git a/extract_loadset b/extract_loadset index 43b2e52..07d3a3a 100755 --- a/extract_loadset +++ b/extract_loadset @@ -32,7 +32,11 @@ while () { chomp; my ($lead,$sub) = split /\t/; $sub =~ s/\s//g; # any whitespace is extraneous - $exclude{$sub} = 1 unless ($sub < $conf->{lowerbound}); + if ($conf->{reverse}) { + $exclude{$lead} = 1 unless ($lead < $conf->{lowerbound}); + } else { + $exclude{$sub} = 1 unless ($sub < $conf->{lowerbound}); + } } close FP; @@ -58,6 +62,7 @@ sub initialize { 'output|o=s', 'tag|t=i', 'subfield|s=s', + 'reverse|r', 'help|h', ); show_help() unless $rc; @@ -85,6 +90,7 @@ Usage is: extract_loadset -l BOUND -i INPUTXML -o OUTPUTXML MATCHSET --output -o MARCXML output file --tag -t MARC tag to use as identifier (default: 903) --subfield -s Subfield of --tag argument (default: 'a') + --reverse -r Output subordinate bibs rather than lead bibs HELP exit; }