AWK Language Programming - Footnotes

# AWK Language Programming

## A User's Guide for GNU AWK

## Edition 1.0

## January 1996

### (1)

These commands are available on POSIX compliant systems, as well as on traditional Unix based systems. If you are using some other operating system, you still need to be familiar with the ideas of I/O redirection and pipes

### (2)

Often, these systems use `gawk` for their `awk` implementation!

### (3)

The ``#!'` mechanism works on Linux systems, Unix systems derived from Berkeley Unix, System V Release 4, and some System V Release 3 systems.

### (4)

The line beginning with ``#!'` lists the full file name of an interpreter to be run, and an optional initial command line argument to pass to that interpreter. The operating system then runs the interpreter with the given argument and the full argument list of the executed program. The first argument in the list is the full file name of the `awk` program. The rest of the argument list will either be options to `awk`, or data files, or both.

### (5)

The `sed` utility is a "stream editor." Its behavior is also defined by the POSIX standard.

### (6)

The internal representation uses double-precision floating point numbers. If you don't know what that means, then don't worry about it.

### (7)

Some early implementations of Unix `awk` initialized `FILENAME` to `"-"`, even if there were data files to be processed. This behavior was incorrect, and should not be relied upon in your programs.

### (8)

Computer generated random numbers really are not truly random. They are technically known as "pseudo-random." This means that while the numbers in a sequence appear to be random, you can in fact generate the same sequence of random numbers over and over again.

### (9)

This consequence was certainly unintended.

### (10)

As of December 1995, with final approval and publication hopefully sometime in 1996.

### (11)

Occasionally there are minutes in a year with one or two leap seconds, which is why the seconds can go up to 61.

### (12)

This is because ANSI C leaves the behavior of the C version of `strftime` undefined, and `gawk` will use the system's version of `strftime` if it's there. Typically, the conversion specifier will either not appear in the returned string, or it will appear literally.

### (13)

If you don't understand any of this, don't worry about it; these facilities are meant to make it easier to "internationalize" programs.

### (14)

Not recommended.

### (15)

Your version of `gawk` may use a directory that is different than ``/usr/local/share/awk'`; it will depend upon how `gawk` was built and installed. The actual directory will be the value of ``$(datadir)'` generated when `gawk` was configured. You probably don't need to worry about this though.

### (16)

Some implementations of `awk` do not allow you to execute `next` from within a function body. Some other work-around will be necessary if you use such a version.

### (17)

ASCII has been extended in many countries to use the values from 128 to 255 for country-specific characters. If your system uses these extensions, you can simplify `_ord_init` to simply loop from zero to 255.

### (18)

This is the Epoch on POSIX systems. It may be different on other systems.

### (19)

Examine the code in section 15.8 Noting Data File Boundaries. Why must `wc` use a separate `lines` variable, instead of using the value of `FNR` in `endfile`?

### (20)

On older, non-POSIX systems, `tr` often does not require that the lists be enclosed in square brackets and quoted. This is a feature.

### (21)

This program was written before `gawk` acquired the ability to split each character in a string into separate array elements. How might this ability simplify the program?

### (22)

"Real world" is defined as "a program actually used to get something done."

### (23)

The path may use a directory other than ``/usr/local/share/awk'`, depending upon how `gawk` was built and installed.

This document was generated on 4 December 1999 using texi2html 1.55k.