[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: '>;' redirection operator [was: [1003.1(2008)/Issue 7 0000530]: Supp

From: Geir Hauge
Subject: Re: '>;' redirection operator [was: [1003.1(2008)/Issue 7 0000530]: Support in-place editing in sed (-iEXTENSION)]
Date: Fri, 23 Dec 2011 01:14:03 +0100

2011/12/22 Bruce Korb <address@hidden>
> When the exact opposite is the useful variation?  I.e. keep-on-failure.
> "-i" for sed is simple, understandable and implemented a lot.

As far as I know, -i is only implemented with GNU sed and BSD sed, and they
are incompatible, BSD sed's -i takes a mandatory argument, while GNU sed's
-i takes an optional string which must be provided in the same argument.

gnused -i.bak sed-script file
bsdsed -i .bak sed-script file

So the only portable way of using sed to "edit" (read: overwrite) a file is

sed sed-script file > file.tmp && mv file.tmp file

I'd welcome this >; syntax.

Geir Hauge

reply via email to

[Prev in Thread] Current Thread [Next in Thread]