Using awk

awk is a programming language that lets you work with information stored in files. With awk programs, you can:
  • Display all the information in a file, or selected pieces of information.
  • Perform calculations with numeric information from a file.
  • Prepare reports based on information from a file.
  • Analyze text for spelling, frequency of words or letters, and so on.

You can combine these operations to perform quite complicated tasks.

awk allows most of the logical constructs of modern computing languages: if-else statements, while and for loops, function calls, and so on.

This appendix introduces some of the principles and concepts of awk. The z/OS® version of awk is based on the POSIX definition of awk, and also supports the functionality of nawk, the new awk. Experienced programmers may prefer to turn directly to the awk - Process programs written in the awk languagecommand description in z/OS UNIX System Services Command Reference. For an excellent reference for awk, see The AWK Programming Language by Alfred V. Aho, Peter J. Weinberger, and Brian W. Kernighan (Addison-Wesley, 1988). Aho, Weinberger, and Kernighan are the people who created awk at AT&T Laboratories, and the name awk comes from their last names.