\u591a\u7ef4\u6570\u7ec4<\/strong><\/div>\nAWK \u672c\u8eab\u4e0d\u652f\u6301\u591a\u7ef4\u6570\u7ec4\uff0c\u4e0d\u8fc7\u6211\u4eec\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u4f7f\u7528\u4e00\u7ef4\u6570\u7ec4\u6a21\u62df\u5b9e\u73b0\u591a\u7ef4\u6570\u7ec4\u3002<\/p>\n
\u5982\u4e0b\u793a\u4f8b\u4e3a\u4e00\u4e2a 3x3 \u7684\u4e09\u7ef4\u6570\u7ec4\uff1a<\/p>\n
100 200 300\r\n400 500 600\r\n700 800 900<\/pre>\n\u4ee5\u4e0a\u5b9e\u4f8b\u4e2d\uff0carray[0][0] \u5b58\u50a8 100\uff0carray[0][1] \u5b58\u50a8 200 \uff0c\u4f9d\u6b21\u7c7b\u63a8\u3002\u4e3a\u4e86\u5728 array[0][0] \u5904\u5b58\u50a8 100, \u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u8bed\u6cd5\uff1a array[\"0,0\"] = 100\u3002<\/p>\n
\u6211\u4eec\u4f7f\u7528\u4e86 0,0 \u4f5c\u4e3a\u7d22\u5f15\uff0c\u4f46\u662f\u8fd9\u5e76\u4e0d\u662f\u4e24\u4e2a\u7d22\u5f15\u503c\u3002\u4e8b\u5b9e\u4e0a\uff0c\u5b83\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\u7d22\u5f15 0,0\u3002<\/p>\n
\u4e0b\u9762\u662f\u6a21\u62df\u4e8c\u7ef4\u6570\u7ec4\u7684\u4f8b\u5b50\uff1a<\/p>\n
$ awk 'BEGIN {\r\narray[\"0,0\"] = 100;\r\narray[\"0,1\"] = 200;\r\narray[\"0,2\"] = 300;\r\narray[\"1,0\"] = 400;\r\narray[\"1,1\"] = 500;\r\narray[\"1,2\"] = 600;\r\n# \u8f93\u51fa\u6570\u7ec4\u5143\u7d20\r\nprint \"array[0,0] = \" array[\"0,0\"];\r\nprint \"array[0,1] = \" array[\"0,1\"];\r\nprint \"array[0,2] = \" array[\"0,2\"];\r\nprint \"array[1,0] = \" array[\"1,0\"];\r\nprint \"array[1,1] = \" array[\"1,1\"];\r\nprint \"array[1,2] = \" array[\"1,2\"];\r\n}'<\/pre>\n\u6267\u884c\u4e0a\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u7ed3\u679c\uff1a<\/p>\n
array[0,0] = 100\r\narray[0,1] = 200\r\narray[0,2] = 300\r\narray[1,0] = 400\r\narray[1,1] = 500\r\narray[1,2] = 600<\/pre>\n\u5728\u6570\u7ec4\u4e0a\u53ef\u4ee5\u6267\u884c\u5f88\u591a\u64cd\u4f5c\uff0c\u6bd4\u5982\uff0c\u4f7f\u7528 asort \u5b8c\u6210\u6570\u7ec4\u5143\u7d20\u7684\u6392\u5e8f\uff0c\u6216\u8005\u4f7f\u7528 asorti \u5b9e\u73b0\u6570\u7ec4\u7d22\u5f15\u7684\u6392\u5e8f\u7b49\u7b49\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u6570\u7ec4\u4f7f\u7528\u7684\u8bed\u6cd5\u683c\u5f0f\uff1a array_name[index]=value array_name\uff1a\u6570\u7ec4\u7684\u540d\u79f0 ind […]<\/p>\n","protected":false},"author":321,"featured_media":201888,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-201886","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/201886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/321"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=201886"}],"version-history":[{"count":2,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/201886\/revisions"}],"predecessor-version":[{"id":201890,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/201886\/revisions\/201890"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/201888"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=201886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=201886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=201886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}