M.V.Johnson wrote:
> ...
> Okay Bob,
>
> Her is the whole story. :-D
>
> I am processing a directory full of .txt files. These .txt files have
> the following structure:
>
> (DEVICE FILE: 74LVT16244A-TSSOP48_1)
> PACKAGE 'TSSOP-48-S0'
> CLASS IO
> PINCOUNT 48
> PINORDER 'LVT16244A-TSSOP48_1' A0 A1 A2 A3 Y0 Y1 Y2 Y3 '~OE'
> PINUSE 'LVT16244A-TSSOP48_1' IN IN IN IN TRI TRI TRI TRI IN
> FUNCTION G1 'LVT16244A-TSSOP48_1' 47 46 44 43 2 3 5 6 1
> END
>
> I simply need to remove the line that starts with the word "PINUSE",
> but ONLY if the line that starts with the word CLASS does not
> have the IC in the
> second field. The possible flavors of that line are CLASS IC, CLASS
> IO, CLASS DISCRETE.
>
> My next task will be to account for the PINUSE line wrapping past one
> line only. I'm just trying to take it one step at a time. :-)
Tie::File would work well for something like this I think:
#!/usr/bin/perl
use strict;
use Tie::File;
for (<*.txt>) {
tie my @arr, 'Tie::File', $_ or die $!;
@arr = grep $_ !~ /^PINUSE/, @arr unless grep /^CLASS IC/, @arr;
untie @arr;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]