001、
[root@pc1 test02]# ls a.txt [root@pc1 test02]# cat a.txt ## 测试数据 01 02 03 04 05 06 07 08 09 10 ## 获取数组的长度 [root@pc1 test02]# awk 'BEGIN{ay["a"] = 10; ay["b"] = 33} {len = length(ay); print $0} END {print len}' a.txt 01 02 03 04 05 06 07 08 09 10 2
。