Subject: bug#13028: inplace

From: Pádraig Brady <[email-masked]>
Date: Thu, 29 Nov 2012 15:35:09 +0000

On 11/29/2012 03:20 PM, Reuben Thomas wrote:
> On Fri, 14 May 2004 15:53:04 +0600 (YEKST), Victor Porton offered his handy "inplace" script to coreutils, which runs a filter on a file in-place. A couple of replies said there was no need for this as one could do in-place editing with perl or sed, but I think that was misguided, as the point of inplace is that it works with any filter. I just used it with xml_grep:
>
> inplace "xml_grep --exclude 'ul[@class=\"toc\"]' \"\$IN\" > \"\$OUT\"" "$book.xhtml"
>
> I attach an updated version of inplace with some bashisms and typos fixed.
>

I definitely think this is worthwhile.
In fact I mostly finished such a script here
that would handle all the atomic, backup, permissions, etc.:
http://lists.gnu.org/archive/html/bug-coreutils/2010-03/msg00213.html
See also: http://www.pixelbeat.org/docs/unix_file_replacement.html

Where to put such a script is an issue.
We were thinking of a contrib/ folder for higher level
scripts like this that could leverage coreutils/
Translations in the shell script was one thing that was
I was wondering about, which I need to look at.

Also I was wondering what to call it. rp, inplace, replace, ...
and in the meantime I noticed David Wheeler proposed much the same thing
with the "rewrite" util:
http://permalink.gmane.org/gmane.comp.standards.posix.austin.general/5348

rewrite is my favorite name so far.

I'll work on this script after I finish a pending
SELinux patchset I'm working on.

thanks,
Pádraig.