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?