Re: sed -i
- From: Yar Tikhiy <yar@xxxxxxxxxxxxxxxx>
- Date: Fri, 30 Mar 2007 20:01:19 +0400
On Tue, Mar 27, 2007 at 12:11:06PM +0100, Alex Zbyslaw wrote:
Yar Tikhiy wrote:
As a Joe Random sed user, I'd agree with Yar. The GNU behaviour makesAren't sed's addresses required to be cumulative across its
input files?
http://www.opengroup.org/onlinepubs/009695399/utilities/sed.html
That makes sense for filter mode because it's equvalent to
concatenating the files in advance:
cat files ... | sed expression
OTOH, in-place mode selected by a -i option can be seen as follows:
for f in files ...; do
sed expression < $f > $f.tmp && mv $f $f.bak && mv $f.tmp $f
done
I.e., each file preserves its individuality. This can be at logical
conflict with cumulative addresses across all files.
more sense in most practical examples I can think of.
Perhaps a touch of feaping creaturism, but we could just add a -I flag
which behaved as -i does now, and make -i behave as GNU. I bet I
*could* construct examples where the current behaviour was what I desired.
Thank you for supporting me! I've just looked at the code and it
seems to me that it should be rather easy to preserve the current
semantics under a -I flag, too. They are too neat to throw them
away.
--
Yar
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- References:
- sed -i
- From: Yar Tikhiy
- Re: sed -i
- From: Joseph Koshy
- Re: sed -i
- From: Yar Tikhiy
- sed -i
- Prev by Date: 6.2: reproducible hang on amd64, traced to 24h of commits
- Next by Date: Re: sed -i
- Previous by thread: Re: sed -i
- Next by thread: Re: sed -i
- Index(es):