Programming with awk

Programming with awk

This topic describes a programming language that enables you to handle easily the tasks associated with data processing and information retrieval. With awk, you can tabulate survey results stored in a file, print various reports summarizing these results, generate form letters, count the occurrences of a string in a file, or reformat a data file used for one application package so it can be used for another application package.

The name awk is an acronym formed from the initials of its developers. The name awk denotes both the language and the UNIX system command you use to run an awk program.

awk is an easy language to learn. It automatically does many things that in other languages you have to program yourself. As a result, many useful awk programs are only one or two lines long. Because awk programs are usually smaller than equivalent programs in other languages, and because they are interpreted, not compiled, awk is also a good language for prototyping.

The first part of this topic introduces you to the basics of awk and is intended to make it easy for you to start writing and running your own awk programs. The rest of the topic describes the complete language and is somewhat less tutorial. If you are an experienced awk user, you will find the skeletal summary of the language at the end of the topic particularly useful.

You should be familiar with the UNIX system and shell programming to use awk. Although you do not need other programming experience, some knowledge of the C programming language is beneficial because many constructs found in awk are also found in C.

Next topic: Basic awk

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004