Go to the first, previous, next, last section, table of contents.


Special File Names

When doing I/O redirection from either print or printf into a file, or via getline from a file, gawk recognizes certain special file names internally. These file names allow access to open file descriptors inherited from gawk's parent process (usually the shell). The file names are:

`/dev/stdin'
The standard input.
`/dev/stdout'
The standard output.
`/dev/stderr'
The standard error output.
`/dev/fd/n'
The file denoted by the open file descriptor n.

In addition, reading the following files provides process related information about the running gawk program. All returned records are terminated with a newline.

`/dev/pid'
Returns the process ID of the current process.
`/dev/ppid'
Returns the parent process ID of the current process.
`/dev/pgrpid'
Returns the process group ID of the current process.
`/dev/user'
At least four space-separated fields, containing the return values of the getuid, geteuid, getgid, and getegid system calls. If there are any additional fields, they are the group IDs returned by getgroups system call. (Multiple groups may not be supported on all systems.)

These file names may also be used on the command line to name data files. These file names are only recognized internally if you do not actually have files with these names on your system.

See section Special File Names in gawk, for a longer description that provides the motivation for this feature.


Go to the first, previous, next, last section, table of contents.