From: Shawn Boyette Date: Wed, 15 Apr 2009 04:23:27 +0000 (+0000) Subject: fixed (i think) trailing error in tag stripping X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=f2a930739a04db98a679a9e46f7b82ceffe9fdd6 fixed (i think) trailing error in tag stripping made strip9 the default. removed now-extraneous code --- diff --git a/marc_cleanup b/marc_cleanup index ee09e3c..025e604 100755 --- a/marc_cleanup +++ b/marc_cleanup @@ -90,13 +90,6 @@ while ( buildrecord() ) { edit("Non-numerics in tag") unless $conf->{autoscrub}; next; } - # test for existing 901/903 unless we're autocleaning them - unless ($conf->{'strip9'} or $conf->{'no-strip9'}) { - if ($match == 901 or $match == 903) { - edit("Incoming 901/903 found in data"); - next; - } - } } # subfields can't be non-alphanumeric @@ -300,10 +293,9 @@ sub buildrecord { # excise unwanted tags if ($istrash) { - if ($l =~ m|; next } + $istrash = 0 if ($l =~ m|; + next; } if ($l =~ m/has($1) or ($conf->{autoscrub} and $1 =~ /\D/)) @@ -574,13 +566,12 @@ sub initialize { 'original-tag|ot=i', 'original-subfield|os=s', 'script', - 'strip9', 'no-strip9', 'trashfile|t=s', 'trashhelp', 'help|h', ); - show_help() unless $rc; + show_help() unless $rc and @ARGV; show_help() if ($c->{help}); show_trashhelp() if ($c->{trashhelp}); @@ -597,15 +588,14 @@ sub initialize { } else { $c->{trash} = Equinox::Migration::SimpleTagList->new; } - # remove original id sequence tag from trash hash if we know it - $c->{trash}->remove_tag($c->{'original-tag'}) - if ( $c->{'original-tag'} and $c->{trash}->has($c->{'original-tag'}) ); - - # autotrash 901, 903 if strip-nines - if ($c->{'strip9'}) { + # autotrash 901, 903 unless no strip-nines + unless ($c->{'no-strip9'}) { $c->{trash}->add_tag(901); $c->{trash}->add_tag(903); } + # remove original id sequence tag from trash hash if we know it + $c->{trash}->remove_tag($c->{'original-tag'}) + if ( $c->{'original-tag'} and $c->{trash}->has($c->{'original-tag'}) ); my @keys = keys %{$c}; show_help() unless (@ARGV and @keys); @@ -632,8 +622,7 @@ Options --autoscrub -a Automatically remove non-numeric tags in data --nocollapse -n Don't compress records to one line on output - --strip9 Automatically remove any existing 901/903 tags in data - --no-strip9 Don't complain about 901/903 tags in data + --no-strip9 Don't autoremove 901/903 tags in data --trashfile -t File containing trash tag data (see --trashhelp)