f1 c4a_123 350.00 3251.94 -2901.94 (VIOLATED) f1 c4b_123 350.00 2419.08 -2069.08 (VIOLATED) f2 c4emib_2060 250.00 2000.00 -1750.00 (VIOLATED) f2 c4emib_2061 250.00 2000.00 -1750.00 (VIOLATED) f2 c4emib_2062 250.00 2000.00 -1750.00 (VIOLATED) f2 c4emib_2063 250.00 2000.00 -1750.00 (VIOLATED) f2 c4emib_2064 250.00 2000.00 -1750.00 (VIOLATED) f2 c4emib_2065 250.00 2000.00 -1750.00 (VIOLATED) and so on #### c4a_123,350.00,3300.00,"Justification","Waived,by","Waived,Date","Approved,by","Approved,date" c4emib_*,250.00,2000.00,"Justification","Waived,by","Waived,Date","Approved,by","Approved,date" #### f1 c4a_123 350.00 3251.94 -2901.94 (WAIVED) f1 c4b_123 350.00 2419.08 -2069.08 (VIOLATED) f2 c4emib_2060 250.00 2000.00 -1750.00 (WAIVED) f2 c4emib_2061 250.00 2000.00 -1750.00 (WAIVED) f2 c4emib_2062 250.00 2000.00 -1750.00 (WAIVED) f2 c4emib_2063 250.00 2000.00 -1750.00 (WAIVED) f2 c4emib_2064 250.00 2000.00 -1750.00 (WAIVED) f2 c4emib_2065 250.00 2000.00 -1750.00 (WAIVED) #### #! /tools/perl/5.8.8/linux/bin/perl use strict; use warnings; use Data::Dumper; # Source script my $report = $ARGV[1] ; my $waiver = $ARGV[3] ; my $result = $ARGV[5] ; # Set up a hash to receive the information my %identifier = (); # Read the violations file into the hash open my $filter, '<', $waiver or die; while (my $vline = <$filter>) { next unless $vline =~ /\S/; #skip blank lines $vline =~ s/^\S+//; #trim leading space my ($pins2, $threshold2, $newthreshold2) = split /,/, $vline; $identifier{$pins2}{'threshold2'} = $threshold2; $identifier{$pins2}{'newthreshold2'} = $newthreshold2; } print Dumper \%identifier; # Read input file line by line and compare 2 files open my $input, '<', $report or die; open my $output, ">", $result or die; while (my $wline = <$input>){ my (undef,$scenario, $pins1, $threshold1, $newthreshold1, $diff, $status) = split /\s+/, $wline; # overwrite values if match if ($_ =~ $identifier{$pins1.}) { if ( ($threshold1 == $identifier{$pins1}{'threshold2'}) && ($newthreshold1 <= $identifier{$pins1}{'newthreshold2'}) ) { $status = '(WAIVED)'; } } printf $output "%-44s %-24s %-8s %-8s %-8s %-10s\n", $scenario, $pins1, $threshold1, $newthreshold1, $diff, $status; } close $filter; close $input; close $output;