initialized to the null string, which is eff ectively zero if converted to a number. There is no need
to \initialize" each variable explicitly in awk, the way you would in C or most other traditional
languages.
译:在AWK中变量可被赋予或者是数字或者是字符串的值。默认是被赋予为空值,如果空串被转
为数为数字它将为0.不需要明确去初始化在AWK中的变量值,而在C或者大多数其它传统语方它是
需要的。
Otherwise, the variable assignment is performed at a time determined by its position among the
input file arguments: after the processing of the preceding input fi le argument. For example:
awk '{ print $n }' n=4 inventory-shipped n=2 BBS-list
译:同样的,变量的赋值执行取决于在输入文件参数中它所属的位置:在之前输入文件处理参数
的后面。比如
awk '{ print $n }' n=4 inventory-shipped n=2 BBS-list
------------------------------------------------------------------------------------------------------------------------------------
Command line arguments are made available for explicit examination by the awk program in an
array named ARGV
译:ARGC是等待输入参数的个数,ARGV是参数存储的数组;
命令行参数经过AWK的实际测试的可用的,它存储于一个数组名字叫作ARGV;
[oracle@localhost ~]$ awk ' BEGIN{
for (i=0;i<ARGC;i++)
print ARGV[i]}' tmpdata2 tmpdata1
--output---
awk
tmpdata2
tmpdata1