##REPORT 01 A ARCUR1GMU# 00112106 F N ARCUR1 ARCUR1 P 02 AR CURRENCY CONVERSION CONTROL - (BY PTR) N 03 FROM FVENDAP1 04 CODE: 10 RECORDING & REPORTING GMU / NON-WHQ ONLY REPORTS 07 00112704 00200103 11 R 3 RD.RDSMODEL C 0008 0001 12 A 0007 000 000 000 000 13 VDLTP02 14 S N VDLTB02 ##REPORT 01 A ARCUR10000 00112106 F N ARCUR1 ARCUR1 P 02 AR CURRENCY CONVERSION CONTROL - (BY PTR) N 07 00112704 00200103 11 R 3 RD.RDSMODEL C 0008 0001 12 A 0007 000 000 000 000 13 VDLTP02 14 S N VDLTB02 #### #!/usr/bin/perl use strict; # input file of ##REPORT cards my $str = do {local $/ = undef; }; # keepers my %keeplist; open (RIDS, '<', 'rids_that_have_versions.txt') or die; while () { chomp; $keeplist{$_} = 1;} my @cards; while ( $str =~ /(##.*?)(?=(##|\Z))/gs ) { my $rid = substr($1, 19, 10); print "$rid: " . ($keeplist{$rid} ? 'y' : 'n') . "\n"; } #### while () { if ( /^##/ ) { my $rid = substr($buffer, 19, 10); $rid =~ s/\s*$//g; print $buffer if $keeplist{$rid}; $buffer = ''; } $buffer .= $_; }