Other Inherited Files (The GNU Awk User’s Guide)
From Get docs
Gawk/docs/latest/Other-Inherited-Files
Next: Special Network, Up: Special Files [Contents][Index]
5.8.1 Accessing Other Open Files with gawk
Besides the /dev/stdin, /dev/stdout, and /dev/stderr special file names mentioned earlier, gawk provides syntax for accessing any other inherited open file:
/dev/fd/N- The file associated with file descriptor
N. Such a file must be opened by the program initiating theawkexecution (typically the shell). Unless special pains are taken in the shell from whichgawkis invoked, only descriptors 0, 1, and 2 are available.
The file names /dev/stdin, /dev/stdout, and /dev/stderr are essentially aliases for /dev/fd/0, /dev/fd/1, and /dev/fd/2, respectively. However, those names are more self-explanatory.
Note that using close() on a file name of the form "/dev/fd/N", for file descriptor numbers above two, does actually close the given file descriptor.