From d84e2cf6b41b5bf9fdf54db11c5080898c8d8390 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 30 Jul 2012 13:42:23 -0400 Subject: [PATCH] utility script to prepare a file of MARCXML records for fingerprinter Given a two-column tab-delimited text file contain bib IDs and MARCXML, produces a MARCXML file with the bib IDs in 903 fields. Signed-off-by: Galen Charlton --- munge_marc_export_for_fingerprint.pl | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) create mode 100755 munge_marc_export_for_fingerprint.pl diff --git a/munge_marc_export_for_fingerprint.pl b/munge_marc_export_for_fingerprint.pl new file mode 100755 index 0000000..e07c60d --- /dev/null +++ b/munge_marc_export_for_fingerprint.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +# Copyright 2009-2012, Equinox Software, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Utility script to prepare a file of MARCXML records extracted from an Evergreen +# database for fingerprinter by adding 903 fields. Usage: +# echo "select id || chr(9) || REGEXP_REPLACE(marc, E'\\n','','g') from biblio.record_entry where not deleted and id < $BIBIDSTART" > $BIN/incumbent_bibs.sql +# psql -A -t -U $DBUSER < $BIN/incumbent_bibs.sql | munge_marc_export_for_fingerprint.pl > $INTER/incumbent.mrc + +while (<>) { + my ($id, $rest) = split /\t/, $_, 2; + $rest =~ s!!!g; + $rest =~ s!!$id!; + $rest =~ s!!$id!; + print $rest; +} + -- 1.7.2.5