command line parameter

The awk extraction and reporting language uses traditional conventions for accessing command line parameters. The command line arguments are stored in the [[array?]] ARGV, and the number of parameters are stored in the [[scalar?]] variable ARGC.

 #!/usr/bin/awk -f
  
 BEGIN {
   print "There are " ARGC "command line parameters"
   for(l=1; l<ARGC; l++) {
     print "Argument " l " is " ARGV[l]
   }
 }

The value of ARGV[0] is unreliable and varies across systems

By convention ARGV[0] contains the name of the [[script?]] being utilized. However, this behaviour is not reliable and it is not consistent across systems. Some systems may report the name of the awk interpreter, rather than the name of the [[script?]] or [[pathname?]] components may be included.