Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

(bbq) RE: Evolution of an Obfuscated Throwaway Script

by BBQ (Curate)
on Oct 06, 2000 at 08:02 UTC ( [id://35541]=note: print w/replies, xml ) Need Help??


in reply to Evolution of an Obfuscated Throwaway Script

Okay, so this is really NOT obfuscated, but it is a one liner!
# 1st shot df -h | perl -e '@i = <>;s/(\ +)/\,/g && print for @i[1..@i];' > the.c +sv # 2nd shot df -h | perl -e '/^\w/&&next||s/\ +/\,/g&print for<>' > the.csv
I kinda like the look, but merlyn has already pointed out that s/// for is bad. :)

#!/home/bbq/bin/perl
# Trust no1!

Replies are listed 'Best First'.
RE: (bbq) RE: Evolution of an Obfuscated Throwaway Script
by DrManhattan (Chaplain) on Oct 14, 2000 at 01:58 UTC
    df -h | perl -lpe 's/\s+/,/g' > the.csv
    FORE!

    Sorry, I know it's supposed to be obfuscated, but I can't resist the urge to golf. :)

    -Matt

      I would definitly stand up and clap if it weren't for one small detail. The first line in this case would read:
      Filesystem,Size,Used,Avail,Use%,Mounted,on

      Yeah, I know... I'm being a picky sore looser! :)

      #!/home/bbq/bin/perl
      # Trust no1!
RE: (bbq) RE: Evolution of an Obfuscated Throwaway Script
by mischief (Hermit) on Oct 16, 2000 at 13:39 UTC
    where did merlyn point out that the s/// for is bad? why is this?
      Yeah, just where did I point out that that was bad?

      And remember, I have different rules for Obfuscated vs. Golf vs. Bowling vs. 10-minute hacks vs. actual code that a customer paid for vs. training materials. Don't paint me with a broad sword there, or something like that.

      -- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-29 13:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found