【发布时间】:2016-03-17 07:31:53
【问题描述】:
我有一个包含大量行的文件。这些行在末尾附加了文本。现在我希望这些行按升序排序。
例子:
I have {few_1} lines here like this and so on
I have {few_101} lines here like this and so on
I have {few_21} lines here like this and so on
I have {few_11} lines here like this and so on
I have {few_31} lines here like this and so on
I have {few_41} lines here like this and so on
I have {few_51} lines here like this and so on
我需要文件看起来像这样:
I have {few_1} lines here like this and so on
I have {few_11} lines here like this and so on
I have {few_21} lines here like this and so on
I have {few_31} lines here like this and so on
I have {few_41} lines here like this and so on
I have {few_51} lines here like this and so on
I have {few_101} lines here like this and so on
我已经尝试过了,但没有按预期工作。
sort -k7,7 -n filename
非常感谢任何帮助。
【问题讨论】:
-
请注意,对于代码或数据,选择要格式化的块,然后使用编辑框左上角的
{}工具。祝你好运。 -
为什么要更改数据?你还需要帮助吗?
-
是的,请......我试过 -k3.2n.. 使用 htis 类型的数据
-
使用
sort -k3.7n。同样,我希望-k3.6n能够工作,但是当它不起作用时,我增加了数字。祝你好运。