-
Book Overview & Buying
-
Table Of Contents
Linux Command Line and Shell Scripting Bible - Third Edition
By :
Many programming languages provide arrays for storing multiple values in a single variable. The gawk programming language provides the array feature using associative arrays.
Associative arrays are different from numerical arrays in that the index value can be any text string. You don't have to use sequential numbers to identify data elements contained in the array. Instead, an associative array consists of a hodge-podge of strings referencing values. Each index string must be unique and uniquely identifies the data element that's assigned to it. If you're familiar with other programming languages, this is the same concept as hash maps or dictionaries.
The following sections walk you through using associative array variables in your gawk programs.
You can define an array variable using a standard assignment statement. Here's the format of the array variable assignment:
var[index] = element
In this example, var is the variable...
Change the font size
Change margin width
Change background colour