【发布时间】:2015-12-02 00:06:32
【问题描述】:
我在变量 ArtTEXT 中有这个(演示)文本。
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.
这可能吗?
【问题讨论】:
-
如果您告诉我们这个分隔行的“已知字符串”是什么,您不认为我们可以更轻松地为您提供帮助吗?