March 2018
Beginner to intermediate
416 pages
9h 24m
English
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 =", ARGC }' one two three four
The output of the execution of the preceding command is as follows:
No of arguments = 5
ARGV is an array that stores all the arguments passed to the AWK command, starting from index 0 through to ARGC. ARGV[0] always contains ...
Read now
Unlock full access