#!perl =head2 Name and Description Find bad 007s. Takes file of 007s and spits out file of 007s with extra spaces at the end. Keeps count for statistics. =cut ############################### ############################### use MARC::BBMARC; print "Input file:"; my $extractedinputfile = <>; chomp $extractedinputfile; $extractedinputfile =~ s/^\"(.*)\"$/$1/; print "What field are these from?"; my $fieldextracted = <>; chomp $fieldextracted; $fieldextracted =~ s/^\"(.*)\"$/$1/; print "Output file for bad control nos:"; $extractedbadfields = <>; chomp $extractedbadfields; $extractedbadfields =~ s/^\"(.*)\"$/$1/; open (EXTRACTEDFILE, "<$extractedinputfile") or die "cannot open controlnofile"; open (BADOUTPUTFILE, ">$extractedbadfields") or die "can't open badoutput"; my $runningrecordcount=0; #read line from file while (my $line = ){ ### remove counts before field data ## don't do this ### $line =~ s/^[\d]+?\t//; ### remove trailing tabs $line =~ s/\t\t\s*$//; ###Find oddities (control numbers only) if ($fieldextracted eq '007') { if ($line =~ m/[a-z]\s+$/) {print BADOUTPUTFILE ("$line\n");} } #if control number is type $runningrecordcount++; MARC::BBMARC::counting_print ($runningrecordcount); } #while close EXTRACTEDFILE; close OUTPUTFILE; close BADOUTPUTFILE; print "\n\nPress Enter to quit"; <>;