On 12.11.2020 00:01, Kenny McCormack wrote:
> In article <rohnpk$8qd$
1...@news-1.m-online.net>,
> Janis Papanagnou <
janis_pa...@hotmail.com> wrote:
> ...
>> Unless you use GNU awk specific features I consider using the name of
>> the standard tool 'awk' better to indicate that.
>
> The problem with this mentality is that if you just say "awk", you really
> don't know what you're getting and it can vary a lot from system to system.
> Even if you don't explicitly use any "GAWK extensions", you still have to
> deal with the fact that "awk" can be old and/or buggy. Even if it is
> current, it can still be buggy.
While I understand the "buggy" issue we can explicitly name SunOS/Solaris
with its standard path pointing to a really old and buggy awk, but even
on Solaris you have the standard awk available in /usr/xpg4/bin. All other
awks should anyway be standard. (That's at least widely my observation.)
That said, I even wonder whether your awk solution wouldn't work on Solaris
even with its default old awk, but I have no system to check.
So distinguishing standard from non-standard is, even on Solaris, simply
achievable, and if one has problems with the Solaris default he should just
fix his path setting. And there's always room in /usr/local/bin to install
(if not already there) other versions.
> Although this problem is probably lessened over the years, I think we all,
> as long time readers of comp.lang.awk, know which particular system I have
> in mind as the poster child for this problem.
>
> The way I look at is, if I can't trust a system to have gawk, then I can't
> really trust it to have a usable awk. So, I always write "gawk".
I also understand the wish to have a reliable (and powerful) awk explicitly
named. That's why [on Solaris] I first set the standard path and thus fix
the issues with standard-conformity; and not only WRT awk but with all tools.
And I'd also install GNU awk locally; though - it's been a long time since I
used SunOS/Solaris, so I may be misremembering - I seem to recall that at
some point Sun had GNU awk also available in its delivery (i.e. without need
to install it yourself).
> For example, unless/until you install gawk on a Debian system (or any
> Debian-like system, such as Ubuntu, etc), "awk" gets you "mawk". Now,
> "mawk" is not terrible, but it isn't particularly good either.
I'd expected it to be standard.
> In
> particular, one of the things I love about GAWK (and GNU tools in general)
> is the "no arbitrary limits" philosophy. This means that if I use GAWK,
> even if I don't explicitly use any "GAWK extensions", I can rely on the
> program doing the right thing with very long input lines.
Yes, then you probably need non-obviously visible (non-standard) features.
My point was a view from another perspective; is my program standard and can
it be taken from system A to system B, or do I need to have to install (or
be able to install - which is *not* generally possible!) a specific version
of awk.
To illustrate it; professionally I worked over time in several companies,
and quite some of them had security policies that disallowed installing own
software. If I see software posted that relies on 'gawk' I'd be out of luck
running it in my standard environment. If, OTOH, I see code using 'awk' I'm
confident to be able to run it. Effectively it's just an hint and indication
that the code is standard.
That's why I suggest to use 'awk' where the standard applies, and 'gawk' to
indicate the use of non-standard GNU awk specific features. That of course
needs knowledge of what is a standard and what is an extension.
Similary with shells; unless I am using shell specific features I speak of
"shell" or of 'sh', implying using the standard base. Often I use extensions
(typically the ones that the "prominent", "modern" shells support the same
way) and name/explain it accordingly. And sometimes I name a specific shell
explicitly (often ksh) because of its distinguished feature used.
This was the central point of my suggestion; to indicate by tool name whether
a standard or non-standard feature set is used. And it was only a suggestion,
YMMV.
> I have
> successfully used GAWK to process lines of several hundred thousand
> characters. Most other AWKs, including mawk, will barf on this. [...]
Janis