From 5b673d2e1aeff09ecfb4a3bf2f8652d72e1cb967 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 24 Sep 2008 14:22:47 +0000 Subject: [PATCH] quick and dirty --- filter1per.pl | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) create mode 100755 filter1per.pl diff --git a/filter1per.pl b/filter1per.pl new file mode 100755 index 0000000..ff2b20f --- /dev/null +++ b/filter1per.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +use Time::HiRes qw/time/; +use MARC::Record; +use MARC::File::XML ( BinaryEncoding => 'utf-8' ); + +my $tag = shift; +my $subfield = shift; +my $idfile = shift; +my $marcfile = shift; +my $found = shift; +my $notfound = shift; +if (! ($tag && $subfield && $idfile && $marcfile && $found ) ) { + print "filter1per.pl []\n"; + exit 0; +} + +my %id; + +open F, "<$idfile"; +while () { + chomp; + $id{$_} = 1; +} + +close F; + +my $M; +open $M, '<:utf8', $marcfile; +open $I, '>:utf8', $found; +if ($notfound) { open $S, '>:utf8', $notfound; } + +my $starttime = time; +my $count = 0; +my $icount = 0; +my $scount = 0; +while (<$M>) { + + /tag="$tag" ind1=" " ind2=" ">.*?(\d+)