Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: How to generate files based on some special character?

by AltBlue (Chaplain)
on Jul 22, 2008 at 19:47 UTC ( [id://699408]=note: print w/replies, xml ) Need Help??


in reply to How to generate files based on some special character?

If you are very lazy, you could run this:
$ perl -lane '$F[0] eq "<" and open O, "> $F[1]" or print O $_' large_ +file

Obviously, I wouldn't use this at home, as it could burn it down ;-)

...because there are no error checks (on "file name", open and print) and because of the sloppy 2-arguments usage of open

--
altblue.

Replies are listed 'Best First'.
Re^2: How to generate files based on some special character?
by AltBlue (Chaplain) on Jul 22, 2008 at 20:00 UTC
    Or be even more reckless and drop a few more keys ;-)
    $ perl -ne '/^< (.+)/ and open STDOUT, "> $1" or print' large_file
    God help you if you ever try to use such dumb code against some wild input ;-)

    --
    altblue.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 18:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found