Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Accumulating Column Total for a Particular Key

by GertMT (Hermit)
on Aug 28, 2007 at 06:54 UTC ( [id://635513]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Accumulating Column Total for a Particular Key
in thread Accumulating Column Total for a Particular Key

withouth using modules something like this?
Gert
#!/usr/bin/perl -w use diagnostics; use strict; my $sum0 = 0; my $sum1 = 0; printf "%-9s\t%-35s\t%8s\t%14s\n", "Login ID", "Application", "CPU Min +utes", "Percent of Total"; print "-" x 88 . "\n"; while (<DATA>) { tr/%//d; chomp; next if /^Login/; my @F = split /,/, $_; $sum0 += $F[2]; $sum1 += $F[3]; printf "%-9s\t%-35s\t%5s\t\t%4.1f\n", "$F[0]", "$F[1]", "$sum0", " +$sum1"; } __DATA__ Login ID,Application,CPU Minutes,Percent of Total s2pe,CTI Production ,8455,21.7% sybprd01,OMS,5326,13.7% pctip01,CTI,5098,13.1% lxsadr54,CTI,1742,4.5% pipmp01,SSG-IPM,1742,4.5% maestro,SSG-RAC-Maestro ,1020,2.6% f2pa,"DB2DARI ""stored procedures"" prod",836,2.1% pomgp01,SSG-PMD-Omegamon,56,0.1% pptip01,PTI - Private Client Services,16,0.0% pbmwp01,BMW,3,0.0% s2pv,Merva,1,0.0%

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://635513]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-24 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found