Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: '>;' redirection operator [was: [1003.1(2008)/Issue 7 0000530]: Support in-place editing in sed (-iEXTENSION)]
- X-seq: zsh-workers 30045
- From: Geir Hauge <geir.hauge@xxxxxxxxx>
- To: Bruce Korb <bkorb@xxxxxxx>
- 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
- Cc: Eric Blake <eblake@xxxxxxxxxx>, David Korn <dgk@xxxxxxxxxxxxxxxx>, dash <dash@xxxxxxxxxxxxxxx>, austin-group-l@xxxxxxxxxxxxx, zsh-workers@xxxxxxx, Bash - Bug <bug-bash@xxxxxxx>, miros-discuss@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/9hQRsNNUx07s3wzEghSf7PdyP3Z+ajr8UTrGW/57UQ=; b=k5IJHCVySsCXNc4k4rDd/w97Gsllm9SOf3gW2zkE3GRzMKjr9hwtOm2Tx4ex6F/cRO 6rDnixzrCPz2tgmVW0JfB3hkzqEEvGUThsXDl9IgpO/LshAfN2WpK4cgNcWSgYMDQmrG /OfgIcdeXNi8oqM004/zr8HS5QSA4zOycBH9Q=
- In-reply-to: <4EF3AA9A.9070009@gnu.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <201112221539.pBMFdlaj011933@penguin.research.att.com> <4EF39B1E.80709@redhat.com> <4EF3AA9A.9070009@gnu.org>
2011/12/22 Bruce Korb <bkorb@xxxxxxx>
>
> 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.
E.g.
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
with
sed sed-script file > file.tmp && mv file.tmp file
I'd welcome this >; syntax.
--
Geir Hauge
Messages sorted by:
Reverse Date,
Date,
Thread,
Author