In this section, we discuss the various GAWK-specific variables. They are not available in the original AWK distribution. However, on modern Linux systems, generally these options will work because AWK is set as a symbolic link to the GAWK executable.
Environment variables in GAWK
ARGIND
ARGIND represents the index in the ARGV array to retrieve the current file being processed. When we operate with one file in AWK script, the ARGIND will be 1, and ARGV[ARGIND] will return the filename that is currently being processed.
In the following example, we print the value of ARGIND and the current filename using ARGV[ARGIND] as follows:
$ vi argind.awk
END {
print "ARGIND : ", ARGIND;
print "Current Filename...