Like other programming environments, AWK also has environment variables. In this section, we will discuss the different environment variables available to users in the AWK programming language.
Environment variables in AWK
ARGC and ARGV
The ARGC and ARGV variables are used to pass arguments to the AWK script from the command line.
ARGC specifies the total number of arguments passed to the AWK script on the command line. It always has a value of 1 or more, as it counts the program name as the first argument.
The AWK script filename specified using the -f option is not counted as an argument. If we declare any variable on the command line, it is counted as an argument in GAWK:
$ awk 'BEGIN { print "No of arguments...