Hi Guru's

I think this is a context problem but am not sure. my script is below 
as is some of the data I am trying to parse. As you can see I have 
tried different variations, none of which trap the data I am after. 

i could probably trap it with a split or a if block within the while block 
but I though that this type of while would be more efficient. Can 
anyone show me where I am going wrong. 

Thanx.
Dp.


1  #!/perl -w
2
3  # parse uptime.csv
4
5  $file = "uptime.csv";
6
7  open(FH,$file) || die "Can open $file\n";
8
9  while (<FH>) {
10          chomp;
11          ($date) = ($_ =~ /(2002\/*\/)/);
12          $time =~ /2002.*\s(\d+:\d+)/;
13          ($load) =~ /.*average: (\d.\d+)/;
14          print "$date $time $load\n";
15  }
~

-------------- sample data -----------
2002/04/29 10:00  up 2 days, 14:57,  2 users,  load average: 0.47, 
0.46, 0.42
2002/04/29 10:15  up 2 days, 15:12,  2 users,  load average: 0.47, 
0.39, 0.35
2002/04/29 10:30  up 2 days, 15:27,  3 users,  load average: 0.24, 
0.17, 0.21
2002/04/29 10:45  up 2 days, 15:42,  3 users,  load average: 0.48, 
0.56, 0.54
2002/04/29 11:00  up 2 days, 15:57,  3 users,  load average: 1.15, 
0.56, 0.47

~~
Dermot Paikkos * [EMAIL PROTECTED]
Network Administrator @ Science Photo Library
Phone: 0207 432 1100 * Fax: 0207 286 8668


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to