Awk array iteration for multi-dimensional arrays

后端 未结 5 1299
不思量自难忘°
不思量自难忘° 2020-12-25 13:25

Awk offers associative indexing for array processing. Elements of 1 dimensional array can be iterated:

e.g.

for(index in arr1)
  print \"arr1[\" inde         


        
5条回答
  •  半阙折子戏
    2020-12-25 14:31

    The current versions of gawk (the gnu awk, default in linux, and possible to install everywhere you want), has real multidimensional arrays.

    for(b in a)
       for(c in a[b])
          print a[b][c], c , b
    

    See also function isarray()

提交回复
热议问题