Here's my go using a flag.
#!/usr/bin/perl
use warnings;
use strict;
my $del_qual;
while (<DATA>){
if (/^\S/){
if (/^\w+clk\[\d+\]/){
$del_qual = 0;
}
else{
$del_qual = 1;
}
}
next if $del_qual and /\s+QUALIFIED/;
print qq{$_};
}
__DATA__
qclk[6] INPUT (
! "asdk fd sasd"
VALID (
late_lead 3 ar qclk slope 20
late_lead 3 af qclk slope 04
early_dn 8 ar qclk slope 6
early_up 6 af qclk slope 6
)
cext %0.00394757
cmax %0.005504
QUALIFIED
)
clkout_qclk_61[3] OUTPUT (
)
clkout_qclk_61[2] OUTPUT (
REQUIRED (
earlyp 0.5 br qclk clm(2)
latel_up 5 bf qclk clk(2)
)
REQUIRED (
early_lead_dn 0.004 bf qclk clkdom(2)
late_trail_dn 0.005 br qclk clkdom(2)
)
cext %0.0647336
max_ceff_up %0.187
QUALIFIED
)
qclk[6] INPUT (
! "asdk fd sasd"
VALID (
late_lead 3 ar qclk slope 20
late_lead 3 af qclk slope 04
early_dn 8 ar qclk slope 6
early_up 6 af qclk slope 6
)
cext %0.00394757
cmax %0.005504
QUALIFIED
)
clkout_qclk_61[3] OUTPUT (
)
clkout_qclk_61[2] OUTPUT (
REQUIRED (
earlyp 0.5 br qclk clm(2)
latel_up 5 bf qclk clk(2)
)
REQUIRED (
early_lead_dn 0.004 bf qclk clkdom(2)
late_trail_dn 0.005 br qclk clkdom(2)
)
cext %0.0647336
max_ceff_up %0.187
)
I've assumed that the start of each record is a non space character in the first column. |