Whamcloud - gitweb
b=10959
[fs/lustre-release.git] / lustre-iokit / sgpdd-survey / parse.pl
1 #!/usr/bin/perl -w
2
3 # arg 0 is filename
4 # arg 1 is 'w' or 'r' for reading or writing
5
6 $file = $ARGV[0];
7
8 $type = $ARGV[1];
9 print "$file\n";
10
11
12 open ( PFILE, "$file") or die "Can't open results";
13 while ( <PFILE> ) {
14         chomp;
15         @line = split( /\s+/ );
16         if ( $type eq 'w' ) {
17                 # print "$line[5] $line[7] $line[9]\n";
18                 if( $line[9]) {
19                 $out{$line[5]}{$line[7]} = $line[9];    
20                 }
21         } else {
22                 if( $line[18]) {
23                 # print "$line[5] $line[7] $line[18]\n";
24                 $out{$line[5]}{$line[7]} = $line[18];   
25                 }
26         }
27 }
28
29         foreach $crg ( sort { $a <=> $b }  ( keys %out )) {
30                 print "$crg";
31                 @list = ( sort { $a <=> $b } ( keys %{ $out{$crg} } ));
32                  foreach $thr ( @list ) {
33                         # These are the headers
34                          print ",$thr";
35                  }
36                  print "\n";
37                  print "$crg";
38                  foreach $tthr ( @list ) {
39                          print ",$out{$crg}{$tthr}";
40                  }
41                 print "\n";
42         }
43         
44