CDA Oral Arguments: Filtering the OPAC
Elizabeth Hamilton
hamilte at one.net
Wed Mar 26 21:26:40 EST 1997
Dear Thomas,
How's this...
#! /usr/bin/perl -w
# Open old catalog, search marc record for specified naughty words
# substitute with space and save to new catalog! ;-)
$newcatalog = "newcatalog";
$oldcatalog = "oldcatalog";
open (OLDCATALOG, ">newcatalog") ||
die "Oops we gave it away years ago.\n" {
while (<OLDCATALOG>) {
print if /marc2txt/i;
}
}
close OLDCATALOG;
open (NEWCATALOG ">$newcatalog")
|| die "Can't open file. It's hostage to the Decency League.\n";
while (<NEWCATALOG>) {
s/dirty_word_1//g;
s/dirty_word_2//g;
print;
}
}
close NEWCATALOG;
Keep in mind I'm a Perl novice!
Elizabeth
--
Elizabeth Hamilton
University of Cincinnati Libraries
>Thomas wrote:
>marc2txt oldcatalog | grep -iv "dirty_word_1" | \
> grep -iv "dirty_word_2" | txt2marc > newcatalog
>
>Sure. That'll work. :-)
>
>Thomas ("You could also do it in Perl") Dowling
More information about the Web4lib
mailing list