Hi, I am working on a script. I need to search for specific string and add two lines below that string.
Like this :
This is my file
lvtnfet cmos20lpm lvtnfet_b symbol d g s b PROPMAP m=m
And this would be my output file
lvtnfet_float cmos20lpm lvtnfet_b symbol d g s b PROPMA
+P m=m
lvtnfet_auxpc2 cmos20lpm lvtnfet_b symbol d g s b PROPM
+AP m=m
I am using this code just to test my script :
#!/tool/pandora/.package/perl-5.12.1/libexec/perl5.12.1 -w
use strict;
use warnings;
my $file="device.map";
open (FH, "< $file") || die "Could not open file: $!\n";
my @lines = <FH>;
close(FH);
open (FH, "> $file");
for (@lines){
if ($_=~m/lvtnfet cmos20lpm lvtnfet_b symbol d g s b PR
+OPMAP m=m/)
print FH "lvtnfet_float cmos20lpm lvtnfet_b symbol d g
+s b PROPMAP m=m \n";
print FH "lvtnfet_auxpc2 cmos20lpm lvtnfet_b symbol d g
+s b PROPMAP m=m \n";
}
print FH
close FH;
print "done\n";
I am getting so many errors like these
Bareword found where operator expected at device.map line 4, near "//
+GLOBALFOUNDRIES"
(Missing operator before GLOBALFOUNDRIES?)
Bareword found where operator expected at device.map line 6, near "//
+except"
(Missing operator before except?)
Bareword found where operator expected at device.map line 47, near "m=
+m AREA=area"
Bareword found where operator expected at device.map line 48, near "m=
+m AREA=area"
I hope if someone could help me with that.
Thanks.