- 論壇徽章:
- 1
|
ly5066113@ubuntu:~$ awk 'BEGIN{for(i=0;i<ARGC;i++) print "ARGV["i"]="ARGV[i]}{print ARGV[ARGIND],ARGIND,ARGC,$0}' [abc].txt
ARGV[0]=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
在執(zhí)行{print ARGV[ARGIND],ARGIND,ARGC,$0}輸出的時候?yàn)槭裁礇]有print ARGV[ARGIND] 當(dāng)ARGIND=0的時候的值,是否為awk?
另外我查了下相關(guān)資料Using gawk's ARGIND variable (see Built-in Variables), it is possible to detect when an empty data file has been skipped.
還有下面的描述
ARGIND The index in ARGV of the current file being processed. 命令行中文件序號
是否表明ARGIND是 處理文件,而不是從0到ARGC-1??
求解。。 |
|