#!/usr/local/bin/perl
use warnings;
use strict;
my $inputfile = "file1.txt"; # assign the contents of netlist to a scalar
open FH,$inputfile; # dump the contents of scalar to a file handler
my @results = <FH>; # use an array called results, a vector to store the items present in file handler
close FH; # close the file handler
print "\n---------type n--------------\n" ;
foreach my $line (@results) {
if($line =~ m/(^Mgn\d\.qna.*)/i) # get all the lines that start with Mg*.qna ignore the rest of the lines
{
print "$1\n"; # print the lines found
}
}
print "\n---------type p--------------\n" ;
foreach my $line (@results) {
if($line =~ m/(^Mgp\d\.qpa.*)/i) # get the lines that start with Mg*.qpa and ignore the rest
{
print "$1\n"; # print the lines that start with Mg*.qpa
}
}
This file extracts all lines that start with Mg1.q.....
what Im lookin for is for every line printed it should assign an alphabet for each line as a,b,c......
use warnings;
use strict;
my $inputfile = "file1.txt"; # assign the contents of netlist to a scalar
open FH,$inputfile; # dump the contents of scalar to a file handler
my @results = <FH>; # use an array called results, a vector to store the items present in file handler
close FH; # close the file handler
print "\n---------type n--------------\n" ;
foreach my $line (@results) {
if($line =~ m/(^Mgn\d\.qna.*)/i) # get all the lines that start with Mg*.qna ignore the rest of the lines
{
print "$1\n"; # print the lines found
}
}
print "\n---------type p--------------\n" ;
foreach my $line (@results) {
if($line =~ m/(^Mgp\d\.qpa.*)/i) # get the lines that start with Mg*.qpa and ignore the rest
{
print "$1\n"; # print the lines that start with Mg*.qpa
}
}
This file extracts all lines that start with Mg1.q.....
what Im lookin for is for every line printed it should assign an alphabet for each line as a,b,c......