At 2026-08-26T21:15:58-0600, Stan Marsh wrote:
> >I learned AWK programming because I was looking at some complex sed
> >expressions with { } command groups, b unconditional branches, and
> >whatnot. I wasn't happy with them and I want this script to be
> >intelligible to my coworkers. The AWK scripts that are there now are a
> >huge improvement. So yes, each has its place in my repertoire.
> 
> The CW in the AWK group(s) is that once you get past "s/foo/bar/p" in
> sed, you should switch to AWK.

Well that group sure sounds like a good place to find an opinion on AWK
that is free of bias, good-natured or otherwise.

> Going any further with sed is just asking for pain and suffering.

Not in my view.  It can be asking oneself to think more carefully and
clearly about what one is trying to do with a text transformation.

For me, personally, what I'd call "stateful" sed scripts, by which I
mean ones that require multiline patterns or use of the hold space, are
what demand engagement of the thinking cap.

I like AWK--I don't hate it.  But unless I want to perform arithmetic on
"fields", or require "BEGIN" or "END" blocks, sed gives me all the power
I need in text pattern matching and transformation 99% of the time.

I will concede that a lot of people who maintain sed implementations
other than GNU sed seem to feel about it as you do, and read the POSIX
standard for it, if at all, with deep indifference, which causes many
portability annoyances, some of which I have documented here.

https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/HACKING?h=1.25.0.rc2#n443

The solution is to use a good sed, not one maintained by people who
desperately wish they were doing something else.

> The general feeling is that few people are even aware that "sed" does
> have a programming language in it - and that that (that few people
> know it) is a Good Thing.

No, it's not a good thing.  That stance blinds one to the fundamental
definition of what a programming language is.

Reconsider your habit of elevating your personal preferences to
universal hacker wisdom.  I've read many of your messages to this list
over the past few years, and find you inadequately equipped to serve as
a fount of expertise.  You are free, of course, to say the same of me.

If a person doesn't want to allocate brain cycles to developing
expertise with sed, that's fine.  But it's not, of itself, any sort of
exercise of virtue.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to