1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| use strict;
use warnings;
#my $file = $ARGV[0];
my ($i,$TIMESTAMP,$AUTHOR,$file_name,$spreadsheet);
my $SCRIPTNAME = $0;
my $where = `pwd`;
my @file =();
my @endpoint=();
my @ports=();
my @result=();
my @from_clk=();
chomp ($where);
$TIMESTAMP = `date`;
chomp($TIMESTAMP);
$AUTHOR = `whoami`;
chomp($AUTHOR);
#-------------------------------------------------------------------------------
# Execution Order
#-------------------------------------------------------------------------------
PROCESS_ARGS();
print "-------------------------------------------------------------------------\n";
print "$file_name\n";
print "-------------------------------------------------------------------------\n";
#-------------------------------------------------------------------------------
# PROCESS_ARGS
#-------------------------------------------------------------------------------
# Command line processor
sub PROCESS_ARGS {
my $ARGV = @ARGV;
while (@ARGV) {
$ARGV = shift @ARGV;
# Files can be compared directly ::
if ($ARGV eq "-file") {
$file_name = shift @ARGV;
}
elsif ($ARGV eq "-spreadsheet") {
$spreadsheet = shift @ARGV;
}
elsif ($ARGV eq "-h") {
USAGE();
}
else {
USAGE();
}
}
}
#############################################################################
# open file for read
#############################################################################
open(FILE,"<$file_name") || die "ERROR: the file $file_name not found\n";
open(OUT ,">$where/$spreadsheet") || die "ERROR: the file $file_name found\n";
print OUT "Creation Date :\t\t $TIMESTAMP\n\n";
print OUT "Author :\t \t $AUTHOR\n\n";
print OUT "Nom du script :\t \t $SCRIPTNAME \n\n";
print OUT "\n"; # Add csv sep's for the date's
@file= <FILE>;
for($i=0; $i<$#file+1 ;$i ++)
{
if ($file[$i]=~ s/^\s*-+\s*$//)
{
next;
}
if ($file[$i] =~ s/^\s*-+\s*$//)
{
next;
}
### Ignire commented out line
if ($file[$i]=~ /^#.*$/)
{
next;
}
### Ignorer la dernier ligne
if ($file[$i] =~ s/^\d*//)
{
next;
}
if ($file[$i] =~ s/^#//)
{
next;
}
for ($i =0; $i<$#file+1 ;$i ++) {
print OUT "$file[$i] \n";
}
close FILE;
close OUT;
#-------------------------------------------------------------------------------
# USAGE
#-------------------------------------------------------------------------------
sub USAGE {
print "\n";
print "================================================================================\n";
print "\n";
print "Function : This script is designed to parse multiple PrimeTime constraint report\n";
print " files and correlate the data into a spreasheet format for analysis.\n";
print "\n";
print "Usage : $SCRIPTNAME [options] \n";
print "\n";
print "Options : -h Displays help message.\n";
print " -file <filename> Specify PrimeTime report files explicitly\n";
print " -spreadhseet <csv file> Output to CSV spreadsheet, default = stdout\n";
print "\n";
print "Syntax : \n";
print " $SCRIPTNAME -file <file> [-file <file> ...] [options]\n";
print "\n";
print " options: [-spreadsheet <csv file>]]\n";
print "\n";
print "Examples : \n";
print " $SCRIPTNAME -file mon_text -spreadsheet spreadsheet.csv \n";
exit (0);
} |
Partager