9 Functions

This chapter describes awk’s built-in functions, which fall into three categories: numeric, string, and I/O. gawk provides additional groups of functions to work with values that represent time, do bit manipulation, sort arrays, provide type information, and internationalize and localize programs.

Besides the built-in functions, awk has provisions for writing new functions that the rest of a program can use. The second half of this chapter describes these user-defined functions. Finally, we explore indirect function calls, a gawk-specific extension that lets you determine at runtime what function is to be called.