Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
Sounds like a homework question. –  Coops Dec 1 '09 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 '09 at 11:08
add comment

4 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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
share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.