use strict; use warnings; my $vers = q|1.5|; my $letter = 'A'; #my $file = qq(/var/adm/scripts/20121106_C1SA_174204.tmp); my $file = qq(/var/adm/scripts/tstin); my ($acctnum,@acctnum); open (my $f, "+<", $file) or die $!; while (my $ln = (<$f>)) { #next if ($. == 1..88); next if $ln !~ /\s\s\s\s\d+.*/; next if $ln =~ /\A\w+|\cM\s\d+\.\d+.*/; substr($ln, 1,2) = ""; substr($ln, 0,1) = $letter++; if ( $. % 5 == 1 ) { ###-- every 5th line --### if ( substr($ln, 10, 4) =~ /\s+/ ) { substr($ln, 10, 4, ""); $acctnum = substr($ln, 2, 10); push @acctnum, "F acctnum=$acctnum"; } } ###-- 79/80 are the 2 spaces not needed --### if ( length(substr($ln, 79, 2)) > 1 || substr($ln, 79, 2) =~ /\s*/ ) { substr($ln, 79, 2, ""); print $ln; } else { next; } }