3 # Copyright 2009-2012, Equinox Software, Inc.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 GetOptions ("tags=s" => \@tags,
25 "infile=s" => \$infile);
26 @tags = split(/,/, join(',', @tags));
28 open(FH, $infile) or die "Can't open $infile for reading: $!";
35 # Find the Evergreen bib ID
36 $xml =~ m/<datafield tag="903".+?<subfield code="a">(.+?)<\/subfield>/;
39 # Find each occurrence of each tag specified
41 $tag{$_} = [ $xml =~ m/(<datafield tag="$_".+?<\/datafield>)/g ];
44 # Clean up the results before printing
46 foreach my $key (sort keys %tag) {
47 my $text = join("", @{$tag{$key}});
48 $text =~ s/>\s+</></g;
52 # If we found any specified tags, print what we found.
54 print "$egid\t$output\n";