我在变量ArtTEXT中有这个(演示)文本。AWK - 将一个变量拆分成一个索引而没有循环的数组
1|Reporting Problems and Bugs.
2|Other freely available awk implementations.
5|Summary of installation.
8|How to disable certain gawk extensions.
3|Making Additions To gawk.
7|Accessing the Git repository.
这是一个变量,其中行用已知字符串分隔。
我想将它分成一个数组,其中行首的数字将是使用一个命令的数组行的索引,而不循环行。
结果应该是:
arr[1] => Reporting Problems and Bugs.
arr[2] => Other freely available awk implementations.
arr[5] => Summary of installation.
arr[8] => How to disable certain gawk extensions.
arr[3] => Making Additions To gawk.
arr[7] => Accessing the Git repository.
这可能吗?
[将字符串拆分为使用awk的数组]可能的副本(http://stackoverflow.com/questions/8009664/split-string-to-array-using-awk) –
难道你不认为它会使它如果您告诉我们这个界定线条的“已知字符串”是什么,我们更容易帮助您? –