Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In most cases I find `sed -i` to be more convenient than using ed in scripts, but the paradigm is a little different.


I finally had an occasion to write a .sed script a few weeks ago and it was one of the highlights of my career.


Except for when it breaks on FreeBSD or macOS. The most portable utility nowadays for desktop systems is ex, actually (because some Linux distros don’t include ed).


Well, of course, sed is not the stantard...

It is still much more usable than ed. At least, it makes it easier to debug your script.


In what way? Ed is interactive so you’d be able to act out your script line by line and check for mistakes, which seems easier to me. If you’re cognizant about the differences between ed and ex, you could even debug with vi.


Hum... I was thinking on the lines of debugging an entire shell script. Sed has way more output options.

For a single edition script (one shell command), yeah, I'd say there is no large difference.


Let me guess:Redhat?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: