Hacker News new | ask | show | jobs
by McUsr 586 days ago
Using ed interactively, so you can work out some complex operation step by step, is a valid point for using ed instead of sed. Sometimes however, awk is the correct solution. (Why sit and mess with it, if awk provides a straight forward solution.)
2 comments

Actually interactive editing with ed saved my ass once on my FreeBSD server once. Somehow, my terminal driver (actually I actually used my vt520 even for emails at the time) was totally broken so I only had a single line. I actually managed to edit the settings file with ed to get things straight and do a reboot. However, if you know sed you should be able to handle. However, this was 2001 or so and I somehow doubt that I it will happen again ...
Agreed, though you have to be careful not to rely on gawk (or mawk, etc.) specific features. To be fair, the exact same problem exists between sed and gsed.

I always install gnu-utils on Macs because I find them to be easier, but if I need to share with coworkers, I have to go back and ensure they’re portable.