D
Deepu
Hi All,
I am trying to create a table with some data and store it in a file and
then it should be used in excel to create 3D bar chart. Can some one
provide me with some ideas on how it can be done.
Thanks for your time.
Code:
I have file which contains so many other details and have a line in the
file which start with:
#RESULT: 30 => YES: 10 NO: 10 UNKNOWN: 10
I have several files with each file have a line with RESULT.
##### Code starts here ####
#!/usr/bin/perl
@dirList= qw(FILE1 FILE2 FILE3 FILE4 FILE5);
foreach $dir (@dirList) {
open (PH, "$dir") || die "Can not open:$dir";
while (<PH>) {
if (/#RESULT: (\d+) => YES: (\d+) NO: (\d+) UNKNOWN: (\d+)/) {
push (@yesArray, $2);
push (@noArray, $3);
push (@unknownArray, $4);
}
}
close (PH);
}
## -- help from Mumia W ---
my $fmt = "-%10s %5s %5s %5s\n";
printf ($fmt, '', qw(YES NO UNKNOWN));
foreach $dir(@dirList) {
printf $fmt, $dir, $yesArray[$_], $noArray[$_], $unknownArray[$_];
$_++;
}
The output generated is:
YES NO UNKNOWN
FILE1 10 8 14
FILE2 6 7 20
FILE3 18 10 10
FILE4 20 12 10
FILE5 10 10 10
Now i am trying to save this table in a file so that it can be read by
Excel and create bar chart. Is there any way possible to automate this
flow.
Thanks for the help.
I am trying to create a table with some data and store it in a file and
then it should be used in excel to create 3D bar chart. Can some one
provide me with some ideas on how it can be done.
Thanks for your time.
Code:
I have file which contains so many other details and have a line in the
file which start with:
#RESULT: 30 => YES: 10 NO: 10 UNKNOWN: 10
I have several files with each file have a line with RESULT.
##### Code starts here ####
#!/usr/bin/perl
@dirList= qw(FILE1 FILE2 FILE3 FILE4 FILE5);
foreach $dir (@dirList) {
open (PH, "$dir") || die "Can not open:$dir";
while (<PH>) {
if (/#RESULT: (\d+) => YES: (\d+) NO: (\d+) UNKNOWN: (\d+)/) {
push (@yesArray, $2);
push (@noArray, $3);
push (@unknownArray, $4);
}
}
close (PH);
}
## -- help from Mumia W ---
my $fmt = "-%10s %5s %5s %5s\n";
printf ($fmt, '', qw(YES NO UNKNOWN));
foreach $dir(@dirList) {
printf $fmt, $dir, $yesArray[$_], $noArray[$_], $unknownArray[$_];
$_++;
}
The output generated is:
YES NO UNKNOWN
FILE1 10 8 14
FILE2 6 7 20
FILE3 18 10 10
FILE4 20 12 10
FILE5 10 10 10
Now i am trying to save this table in a file so that it can be read by
Excel and create bar chart. Is there any way possible to automate this
flow.
Thanks for the help.