Re: sed -i



On Mon, Mar 26, 2007 at 08:57:14PM +0530, Joseph Koshy wrote:
Recently noticed that our sed(1) differs from its GNU
analog in that in -i mode it considers all files as a
single sequence of lines while the latter treats each file
independently. The in-line mode isn't in POSIX, so it isn't
really clear which way is correct.

Aren'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.

--
Yar
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: question about resolutions
    ... Digital broadcast TV does not have blanking. ... Analog TVs didn't have buffering, ... OTOH, the component analog signals do have such blanking times because this ...
    (alt.tv.tech.hdtv)
  • Re: sed -i
    ... analog in that in -i mode it considers all files as a ... single sequence of lines while the latter treats each file ... FreeBSD Volunteer, http://people.freebsd.org/~jkoshy ...
    (freebsd-hackers)
  • Re: Blu Ray or HD player ?
    ... OTOH, it will output 5.1, HD over optical and over ... | HDMI (HD audio). ... Blu-ray owners listen to analog audio. ... players costing more than $500 that didn't support 5.1 analog. ...
    (alt.tv.tech.hdtv)