Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: A little golf anyone?

by robartes (Priest)
on Oct 30, 2002 at 20:59 UTC ( [id://209232]=note: print w/replies, xml ) Need Help??


in reply to A little golf anyone?

Here's one to get people started. It weighs in at 164 162 characters and is probably disqualified for not pretty-printing the output, but it does what you ask:
df -k|perl -ne'print join"\t",map{/^\d+$/?($_=$_/1024)<1?p($_*1024)."K +":($_=$_/1024)<1?p($_*1024)."M":p($_)."G":$_}split/\s+/;print"\n";sub + p{sprintf"%.2f",shift}'

CU
Robartes-

Update: Killed two spaces.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-26 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found