public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Fabian Groffen <grobian@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] RFC: sed script redundancy
Date: Fri, 20 May 2011 17:56:00 +0200	[thread overview]
Message-ID: <20110520155600.GB24801@gentoo.org> (raw)
In-Reply-To: <20110520173922.391ea292@epia.jer-c2.orkz.net>

On 20-05-2011 17:39:22 +0200, Jeroen Roovers wrote:
> I've looked into sed's internal solutions to no avail, but something
> like -i[SUFFIX] might help, since it gives you a backup file to compare
> with the file that's being streamed.
> 
> The idea is to pass the result to
>   | diff -u $file $file[SUFFIX]
> to figure out what was changed, and what sed script changed it.

I like your idea a lot.

I had to do a similar thing once in eapify, and back then I came up with
the following hack:

  sed -e "<pattern>" "${file}" | diff "${file}" -

followed by the actual sed -i -e ...

This way I didn't need to write an intermediate file.


-- 
Fabian Groffen
Gentoo on a different level



  reply	other threads:[~2011-05-20 15:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20 15:39 [gentoo-dev] RFC: sed script redundancy Jeroen Roovers
2011-05-20 15:56 ` Fabian Groffen [this message]
2011-05-21 17:34   ` Jeroen Roovers
2011-05-22 10:50     ` Fabian Groffen
2011-05-29 10:44       ` Christopher Schwan
2011-05-29 11:00         ` Fabian Groffen
2011-05-29 11:49           ` Christopher Schwan
2011-10-28  1:08 ` [gentoo-dev] " Ryan Hill
2013-06-10  3:47 ` [gentoo-dev] " Jeroen Roovers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110520155600.GB24801@gentoo.org \
    --to=grobian@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox