Merge branch 'master' of git+ssh://git.sitka.bclibraries.ca/sitka/sitka-tools
[sitka/sitka-tools.git] / marc_export_custom / stats.pl
1 #!/usr/bin/perl
2 use MARC::Batch;
3 use strict;
4 use warnings;
5 my $batch = MARC::Batch->new( 'USMARC', @ARGV );
6 $batch->strict_off();
7 $batch->warnings_off();
8 my $count_raw = 0;
9 my $count_901c = 0;
10 while ( my $marc = $batch->next ) {
11     $count_raw++;
12     my $field_901c = $marc->subfield(901,"c");
13     if(defined $field_901c) {
14         chomp $field_901c;
15         $count_901c++ if ($field_901c =~ /^.+$/);
16     }
17 }
18 printf "Count (raw): %d\n",$count_raw;
19 printf "Count (901c): %d\n",$count_901c;