Re: Sed and redirection into the same file

Christian Lerrahn <[email protected]> Sat, 30 Sep 2006 11:24:30 +1000
Newsgroups gmane.org.user-groups.mlug.main
Message-ID <20060930112430.38cf2e2b@localhost>
Hi Brendon,
hi Joshua,
> You can't do in-place file edits with sed.  Stick with what you found
> to work and just rename the .new file if it's non-zero in size
> otherwise delete it. e.g:

Wrong. This is from "man sed" and I've used it before

"       -i[SUFFIX], --in-place[=SUFFIX]

              edit files in place (makes backup if extension supplied)"

Works exactly like "perl -pi".

Cheers,
Christian