[Lemon-devel] sed -i

Maurice Diamantini Maurice.Diamantini at ensta.fr
Wed Oct 8 07:43:34 CEST 2008


Le 7 oct. 08 à 15:34, Barasz Mihaly a écrit :

> On Tue, Oct 07, 2008 at 11:57 +0100, Alpár Jüttner wrote:
>> Hi,
>>
>> I've just noticed that my sed has an -i option for in place editing.
>> Could anyone tell me how standard this option is? Currently, we use a
>> workaround for this in all of our source code maintenance scripts.
>
> This option exists in GNU sed since about 2002. But AFAIK it exists  
> only
> in GNU sed (which is of course the default on all linux systems...)
>
> Btw, you can always use "perl -i -p -e 's/some/thing/' file" instead  
> of
> "sed -i -e 's/some/thing/' file"...

On MacosX Leopard (10.5.5) :

type -a sed
    => sed is /usr/bin/sed

man sed
    => ...
      -i extension
          Edit files in-place, saving backups with the specified
          extension.  If a zero-length extension is given,
          no backup will be saved.  It is not recommended to give a
          zero-length extension when in-place editing files, as you
          risk corruption or partial content in situations where
          disk space is exhausted, etc.

-- Maurice




More information about the Lemon-devel mailing list