#! /tools/perl/5.8.8/linux/bin/perl use strict; use warnings; use Data::Dumper; # Source script my $report = $ARGV[1] || 'report.txt' ; my $waiver = $ARGV[3] || 'waiver.csv'; my $result = $ARGV[5] || 'result.txt'; # Set up a hash to receive the information my %identifier = (); # Read the violations file into the hash open my $filter, '<', $waiver or die "Could not open $waiver : $!"; while (my $vline = <$filter>) { next unless $vline =~ /\S/; #skip blank lines $vline =~ s/^\s+//; # trim leading spaces my ($pins2, $w2, $h2) = split /,/, $vline; $identifier{$pins2}{$w2} = $h2; } print Dumper \%identifier; # Read input file line by line and compare 2 files open my $input, '<', $report or die "Could not open $report : $!"; open my $output, '>', $result or die "Could not open $result : $!"; my $header = 1; while (my $wline = <$input>){ # skip checking the heading text if ($header == 1){ print $output $wline; $header = 0 if ($wline =~ /-------/); next; } # delete the contents if matched # undef is leading space my (undef,$pins1, $nets, $w1, $h1, $slack) = split /\s+/, $wline; if (exists $identifier{$pins1}{$w1} && $identifier{$pins1}{$w1} >= $h1) { # skip matched line print "DELETED $wline"; } else { print $output $wline; } } close $filter; close $input; close $output;