#!/usr/bin/perl
+require 5.10.0;
use strict;
use warnings;
# subfields can't be non-alphanumeric
if ($record[$ptr] =~ /<subfield code="(.*?)"/) {
- my $match = $1;
- if ($match =~ /\P{IsAlnum}/ or $match eq '') {
+ if ($1 =~ /\P{IsAlnum}/ or $1 eq '') {
edit("Junk in subfield code/Null subfield code");
next;
}
}
+ # subfields can't be non-alphanumeric
+ if ($record[$ptr] =~ /<subfield code="(\w{2,})"/) {
+ edit("Subfield code larger than 1 char");
+ next;
+ }
$ptr++;
}
# automatable subfield maladies
$record[$ptr] =~ s/code=" ">c/code="c">/;
- $record[$ptr] =~ s/code=" ">\$/code="c"$>/;
+ $record[$ptr] =~ s/code=" ">\$/code="c">\$/;
}
}
show_trashhelp() if ($c->{trashhelp});
# defaults
- if ($c->{prefix}) {
- $c->{output} = join('.',$c->{prefix},'marc','xml');
- $c->{exception} = join('.',$c->{prefix},'marc','ex');
- }
+ my $pfx = $c->{prefix} // "bibs";
+ $c->{output} = join('.',$c->{prefix},'clean','marc','xml');
+ $c->{exception} = join('.',$c->{prefix},'exception','marc','xml');
$c->{'renumber-tag'} = 903 unless defined $c->{'renumber-tag'};
$c->{'renumber-subfield'} = 'a' unless defined $c->{'renumber-subfield'};
$c->{window} = 5;
--output -o Cleaned MARCXML output filename
--exception -x Exception (dumped records) MARCXML filename
or
- --prefix=<PREFIX>> -p Shared prefix for output/exception files. Will
- produce PREFIX.marc.xml and PREFIX.ex.xml
-
- --trashfile -t File containing trash tag data (see --trashhelp)
+ --prefix=<PREFIX>> -p Shared prefix for output/exception files. Will produce
+ PREFIX.clean.marc.xml and PREFIX.exception.marc.xml
--renumber-from -rf Begin renumbering id sequence with this number
--renumber-tag -rt Tag to use in renumbering (default: 903)
and renumbering is in effect, an old-to-new mapping
file (old2new.map) will be generated.
- --nocollapse -n Don't compress records to one line on output
--autoscrub -a Automatically remove non-numeric tags in data
+ --nocollapse -n Don't compress records to one line on output
--strip-nines Automatically remove any existing 901/903 tags in data
+ --trashfile -t File containing trash tag data (see --trashhelp)
+
--script Store human-initiated ops in scriptfile (.mcscript)
Not yet implemented