News for hackers. Stuff that matters.
Re:Sed(1) one-liners by pkrumins on Thursday January 07, 2010 @12:44PM (#1037509)
Option -i is not defined in POSIX sed. That's probably the reason author didn't include it in his list.

I have heard that it's GNU sed option only. (But can't currently say if it's 100% true.)

Re:Sed(1) one-liners by silentbicycle on Thursday January 07, 2010 @01:45PM (#1037706)
There's no reason why this functionality should be in sed when it can be implemented on its own and re-used. IIRC there's an an example script to for that in _The Unix Programming Environment_. Better to use sudo than have everything implement its own sudo-like functionality, etc.

See "UNIX Style, or cat -v Considered Harmful" by Rob Pike (http://harmful.cat-v.org/cat-v/) for a longer discussion of this.

Re:Sed(1) one-liners by imurray on Thursday January 07, 2010 @02:38PM (#1037847)
In place operations have been implemented as a standalone utility: sponge from moreutils.

    sed 's/blah/foo/' file | sponge file
Re:Sed(1) one-liners by wendroid on Wednesday January 20, 2010 @09:55AM (#1064845)
The irony

s stands for stream

there is no s in ed

Re:Sed(1) one-liners by silentbicycle on Thursday January 07, 2010 @10:11PM (#1038723)
I checked - it's pgs. 152-156. They call their utility "overwrite".

"...Many other commands could also use a -o command. For example, sed could edit a file in place: ... It would be impractical to modify all such commands to add the option. Furthermore, it would be bad design: it is better to centralize functions, as the shell does with the > operator."

Re:Sed(1) one-liners by rdtsc on Thursday January 07, 2010 @03:02PM (#1037913)
Yes, thank you. Forgot to qualify that -i is only in GNU sed.

But I think it is in GNU sed for a reason -- it is a practical shortcut. The only thing I use sed for is to do search and replaces. If the command spanned 2 lines or had pipes and redirects a lot of people just wouldn't remember it.

Re:Sed(1) one-liners by pkrumins on Friday January 15, 2010 @11:01AM (#1055108)
I agree. It's very practical.
Re:Sed(1) one-liners by wendroid on Monday January 18, 2010 @12:53PM (#1060391)
All pollution is practical, it takes discipline to dispose of waste properly.
Re:Sed(1) one-liners by wendroid on Tuesday January 19, 2010 @11:27AM (#1062445)
man ed
Re:Sed(1) one-liners by wendroid on Tuesday January 19, 2010 @11:26AM (#1062443)
If I'd want to edit in place I use ed

If I want to edit a stream I use sed