How to initialize an array of arrays in awk?

前端 未结 5 1820
心在旅途
心在旅途 2020-12-14 06:42

Is it possible to initialize an array like this in AWK ?

Colors[1] = (\"Red\", \"Green\", \"Blue\")
Colors[2] = (\"Yellow\", \"Cyan\", \"Purple\")

5条回答
  •  星月不相逢
    2020-12-14 07:48

    Thanks for the answers. Anyways, for those who want to initialize unidimensional arrays, here is an example:

    SColors = "Red_Green_Blue"
    split(SColors, Colors, "_")
    print Colors[1] " - " Colors[2] " - " Colors[3]
    

提交回复
热议问题