0

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

2
  • Sounds like a homework question.
    – Coops
    Dec 1, 2009 at 11:02
  • Nope, actually I'm learning awk and I wanted to write down a small tutorial for myself but most of the tutorials i found on the web focus on [gmn]awk without mentioning it...
    – Trollhorn
    Dec 1, 2009 at 11:08

4 Answers 4

1

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.

1

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.

1

It should be there. If you want to use ancient awk, run gawk with the --traditional option.

1

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

You must log in to answer this question.