Does the do... while loop work in the original awk? Or has it been introduced in later implementations (nawk, gawk, ...)? Can nawk be considered present on all Unix platforms today?
Greets, Oliver
Does the do... while loop work in the original awk? Or has it been introduced in later implementations (nawk, gawk, ...)? Can nawk be considered present on all Unix platforms today?
Greets, Oliver
The do while loop is documented in Solaris (o)awk so likely predates the newer [gn]awk standard.
I believe all current Unix/Unix like platforms provide either gawk, nawk or a compliant awk.
Per page 49 of The AWK Programming Language book by Aho, Weinberger, and Kernighan (the AWK), it should.
I've not seen a modern UNIX variant that didn't provide nawk, however.
It should be there. If you want to use ancient awk, run gawk with the --traditional
option.
According to info gawk
in Appendix A, Section 1 "Major Changes Between V7 and SVR3.1":
The `awk' language evolved considerably between the release of Version 7 Unix (1978) and the new version that was first made generally available in System V Release 3.1 (1987). This minor node summarizes the changes, with cross-references to further details:
- The `do'-'while' statement