From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QNS4X-0004bl-Ho for garchives@archives.gentoo.org; Fri, 20 May 2011 15:57:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D47D81C01E; Fri, 20 May 2011 15:56:56 +0000 (UTC) Received: from amun.cheops.ods.org (amun.cheops.ods.org [83.161.135.166]) by pigeon.gentoo.org (Postfix) with ESMTP id 1EBADE0693 for ; Fri, 20 May 2011 15:56:26 +0000 (UTC) Received: from tefnut.cheops.ods.org ([2001:980:57a5:1:211:24ff:fe37:e46e] helo=gentoo.org) by amun.cheops.ods.org with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1QNS3s-00006n-5E for gentoo-dev@lists.gentoo.org; Fri, 20 May 2011 17:56:25 +0200 Date: Fri, 20 May 2011 17:56:00 +0200 From: Fabian Groffen To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] RFC: sed script redundancy Message-ID: <20110520155600.GB24801@gentoo.org> Mail-Followup-To: gentoo-dev@lists.gentoo.org References: <20110520173922.391ea292@epia.jer-c2.orkz.net> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20110520173922.391ea292@epia.jer-c2.orkz.net> User-Agent: Mutt/1.5.21 (Darwin 8.11.0, VIM - Vi IMproved 7.3) Organization: Gentoo Foundation, Inc. X-Content-Scanned: by amun.cheops.ods.org (Exim Exiscan) using SpamAssassin and ClamAV X-Archives-Salt: X-Archives-Hash: c02465c1ef14f2a7b47acf0711648526 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 "" "${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