hi all, i'm new to perl so any help would be much appreciated. i need to sort out this few lines(shown below) from a text file and then write to a new text file. i'm pretty confused with the regex.
; Total registers ; 0 ;
; Total pins ; 2 / 635 ( < 1 % ) ;
; Total virtual pins ; 0 ;
; Total block memory bits ; 0 / 6,617,088 ( 0 % ) ;
; DSP block 18-bit elements ; 0 / 384 ( 0 % ) ;
; Total Receiver Channels ; 0 / 8 ( 0 % ) ;
; Total ransmitter Channels ; 0 / 8 ( 0 % ) ;
; Total PLLs ; 0 / 3 ( 0 % ) ;
here's what i've tried:
; Total registers ; 0 ;
; Total pins ; 2 / 635 ( < 1 % ) ;
; Total virtual pins ; 0 ;
; Total block memory bits ; 0 / 6,617,088 ( 0 % ) ;
; DSP block 18-bit elements ; 0 / 384 ( 0 % ) ;
; Total Receiver Channels ; 0 / 8 ( 0 % ) ;
; Total ransmitter Channels ; 0 / 8 ( 0 % ) ;
; Total PLLs ; 0 / 3 ( 0 % ) ;
here's what i've tried:
Code:
open(INFILE, 'd:\test.fit.rpt') or die 'error';
open(OUTFILE, ">output.txt") or die 'error';
while($line = <INFILE>)
{
chomp($line);
if ($line =~ m/[^\s]\s(\w+)[^\s]\s(\d)\s[^\s]\s(\d+)\s[^\s](\d)[^\s+]/)
{
print OUTFILE "$line\n";
}
}
close (INFILE);
Close (OUTFILE);
Comment