Glossary
Glossary
| Term | Definition |
| $0 | A built-in variable that represents the entire input record (the current line). |
| $n | A built-in variable that represents the nth field in the current record, where fields are separated by the value of FS. For example, $1 is the first field. |
| Append Operator (>>) | An output redirection operator that appends data to the end of a specified file. If the file doesn’t exist, it is created. |
| ARGC | A built-in variable that contains the number of arguments provided on the command line. |
| ARGV | A built-in array that stores the command-line arguments. Valid indexes range from 0 to ARGC-1. ARGV[0] typically holds “awk”. |
| Array Membership Operator (in) | An operator used to check for the existence of an index within an array. |
| Associative Array | A data structure in AWK where indexes can be strings or numbers and do not need to be sequential. Arrays can expand or shrink at runtime. |
| AWK | An interpreted programming language specially designed for text processing. Its name is derived from its authors: Alfred Aho, Peter Weinberger, and Brian Kernighan. |
| BEGIN block | An optional block of AWK commands that is executed only once, at the start of the program, before any input lines are read. It is often used for initialization. |
| Body Block | The main part of an AWK program, consisting of a pattern and/or an action block ({awk-commands}). These commands are applied to every input line that matches the specified pattern, or to all lines if no pattern is given. |
| break Statement | A control statement used inside a loop to immediately end the loop’s execution. |
| continue Statement | A control statement used inside a loop to skip the current iteration and proceed to the next one. |
| delete Statement | A statement used to remove an element from an array using its index. |
| do-while Loop | A loop structure that executes an action at least once and then repeatedly executes it as long as a condition at the end of the loop is true. |
| END block | An optional block of AWK commands that is executed only once, at the very end of the program, after all input lines have been processed. |
| exit Statement | A statement used to stop the execution of the entire AWK script. It can accept an integer argument to set the exit status code. |
| FILENAME | A built-in variable that represents the name of the current input file. It is undefined in the BEGIN block. |
| FNR | A built-in variable similar to NR, but it represents the record number relative to the current input file. Its value resets for each new file being processed. |
| for Loop | A loop structure consisting of an initialization, a condition, and an increment/decrement step, which executes an action as long as the condition is true. |
| Format Specifier | A code used within a printf format string (e.g., %s, %d, %f) that defines how a corresponding argument should be formatted for output. |
| FS | A built-in variable that represents the input field separator. Its default value is a space. |
| GAWK (GNU AWK) | The version of AWK written and maintained by the Free Software Foundation (FSF). It is fully compatible with AWK and NAWK and is shipped with GNU/Linux distributions. |
| NAWK | A newer and improved version of the original AWK from AT&T Laboratory. |
| NF | A built-in variable that represents the total number of fields in the current input record. |
| NR | A built-in variable that represents the record number of the current input line, counting cumulatively across all input files. |
| OFS | A built-in variable that represents the output field separator. Its default value is a space. |
| ORS | A built-in variable that represents the output record separator. Its default value is a newline character. |
| **Pipe (` | `)** |
| printf | A built-in function used to produce formatted output, using format specifiers and escape sequences. |
| Redirection Operator (>) | An output redirection operator that writes data to a specified file. It erases the file’s previous contents before the first write operation. |
| Regular Expression | A sequence of characters that specifies a search pattern, used in AWK to match text in input lines. |
| RS | A built-in variable that represents the input record separator. Its default value is a newline character. |
| User-Defined Function | A block of reusable code defined by the programmer to perform a specific task. It can accept arguments and return a value. |
| while Loop | A loop structure that repeatedly executes an action as long as a specified condition remains true. |