On Wed, 29 Jun 2022 19:44:15 -0400, Bob Bridges wrote:
>I've heard the word "awk", but never been exposed to it. I had the
>impression, though, that I've heard of it in the context of Unix; am I
>mistaken?
>
Somewhere in this tangle of threads someone mentioned BASIC for brevity. I
converted
the BASIC sample to Rexx and posted it. It was 10% shorter.
Converting to awk:
BEGIN {
for ( Bottle = 100; Bottle>=1; Bottle -- ) {
print( Bottle " bottles of beer on the wall, " Bottle " bottles of beer" )
print( "Take one down and pass it around, " Bottle-1 " bottles of beer on the
wall" )
}; exit
}
Very similar to the BASIC and Rexx, and very slightly longer than BASIC.
But it's a wretched misuse of awk, ignoring not only regex but especially the
data-driven character of awk. It's comparable to solving the problem
using DFSORT. I'm surprised no one has proposed a DFSORT solution.
or: <https://copy.sh/%62%72%61%69%6e%66%75%63%6b/prog/beer.b>
--
gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN