下面代码,awk中ARGIND为什么没有从 0 开始,而是从 1 开始?
[root@localhost test]# awk 'BEGIN{for (i=0;i<ARGC;i++) print "ARGV["i"] = "ARGV[i]}{print ARGV[ARGIND],ARGIND,ARGC,$0}' [abc].txt
ARGV = awk
ARGV[1] = a.txt
ARGV[2] = b.txt
ARGV[3] = c.txt
a.txt 1 4 a
a.txt 1 4 b
a.txt 1 4 c
b.txt 2 4 d
b.txt 2 4 e
b.txt 2 4 f
c.txt 3 4 g
c.txt 3 4 h
c.txt 3 4 i
[root@localhost test]#
Caiych
11 years, 1 month ago