Note : The spacing of the columns in the carry over file example is different from file 1 and 2 example. Only one space shown between column1 and 2 and no space after L. If the real data is like this you may have more problems.# Define a hash for pk that have -C removed my %hashC=(); . . sub input_data { my ($ix,$filename) = @_; open FILE1, "<", $filename or die "$filename : $!\n"; while ( <FILE1> ) { chomp $_; my ( $key, $le, $date, $company ) = split ',', $_; my $pk = join "\t",$key,$le,$company; # remove -C from key and store if ($pk =~ s/-C$//){ # print "-C removed $pk\n"; $hashC{$pk} = '-C'; } push @{$hash{$pk}[$ix]},fmt_ymd($date); } close FILE1; } sub output_data { my $filename = shift; open OUTFILE, ">", $filename or die "$filename : $!\n"; # primary key for my $pk (sort keys %hash){ my ($key,$le,$company) = split "\t",$pk; # add -C back if required $company .= $hashC{$pk} || ''; . . .
pojACFX 28523, L, 05/01/13, ABCCO-C
In reply to Re: issue with output of file matching
by poj
in thread issue with output of file matching
by rruser
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |