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

Re: In-place file manipulation

by LameNerd (Hermit)
on Apr 30, 2003 at 16:30 UTC ( [id://254369]=note: print w/replies, xml ) Need Help??


in reply to In-place file manipulation

Why not do something like this?
$ your_script < your_input > your_output $ mv your_output your_input

Replies are listed 'Best First'.
Re: Re: In-place file manipulation
by ibanix (Hermit) on Apr 30, 2003 at 17:04 UTC
    Because I'm on Win2k :-{

    Well, the real reason is that this isn't happening on the command line. But thanks anyway.

    Cheers,
    ibanix

    $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;

      Ehm ... the only changes you'd have to make so that this does work under Win2k is to use move /Y<code> instead of <code>mv and to put perl before the script.pl.

      And you might even do it like this:

      perl script.pl < source.txt > result.txt && move /Y result.txt source. +txt
      Where the && means "execute the second command only if the first one did not return an error"

      Jenda
      Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
         -- Rick Osborne

      Edit by castaway: Closed small tag in signature

      Can you get away with installing cygwin?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-24 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found