awk配列のデータを参照するサンプル
サンプルコード
BEGIN {
cft[0] = “apple"
cft[1] = “orange"
cft[3] = “pear"
cft[4] = “banana"
for (i=0; i<6; i++ ) {
if (i in cft) print cft[i]
}
}
$ awk -f awk_demo.awk
apple
orange
pear
banana
Coding Changes the World
サンプルコード
BEGIN {
cft[0] = “apple"
cft[1] = “orange"
cft[3] = “pear"
cft[4] = “banana"
for (i=0; i<6; i++ ) {
if (i in cft) print cft[i]
}
}
$ awk -f awk_demo.awk
apple
orange
pear
banana