Recently I learned
sed for a while and it was awkward experience due to
- need of remembering single-letter commands (
- concept of single hold space for remembering the context – controlled by other similar commands (
I said to myself: couldn't this be made more intuitive? I.e. with more verbose commands (e.g.
p) and more than one buffer – standard variables according to my need (e.g.
And then someone told me:
No, never use
hor any other sed constructs except s, g, and p (with -n) or you are literally using constructs that became obsolete in the mid-1970s when awk was invented. People use those other constructs today strictly for the mental exercise, not to seriously write software, since an equivalent awk solution will be clearer, more efficient, more portable, easier to maintain/enhance, and better in every other meaningful way.
awk? I immediately jumped on and fell in love with it. Many of my multi-line programs worked on first run, without any debugging. From what I since then studied about the awk, I think it is able to completely supersede the sed. Or is there some sed feature (which I missed) effect of which cannot be easily achieved by the awk? Is there any reason why an awk user would run sed?
Edit: this is not a question "which is better", but a comparison of feature sets. Is there a feature in sed effect of which cannot be achieved similarly efficiently in awk, but it would need much more awk code?