如何对文本进行删除重复行和按数字排序的操作
有类似以下文本文件:(OCC)COMBINATION #1
310 1812 0 0 0 0 0 Flex XSNB
55 0 0 229210 0 0 0 Rigid +Z
2740 43114 0 0 0 0 0 Rigid X
(OCC)COMBINATION #1
2780 0 70361 0 0 0 0 Rigid Y
2870 0 0 125519 0 0 0 Rigid +Z
(OCC)COMBINATION #1
5920 1477 4106 5995 11777 3365 6782 Displ. Reaction
(OCC)COMBINATION #2
5810 11683 60351 33718 50689 41126 56650 Displ. Reaction
5840 14139 61611 26507 44224 81387 127760 Displ. Reaction
5960 2673 2963 7167 11651 2569 5981 Displ. Reaction
(OCC)COMBINATION #2
50 0 0 128584 0 0 0 Prog DesignVSH
80 0 0 230385 0 0 0 Prog DesignVSH
(OCC)COMBINATION #3
2460 0 0 60658 0 0 0 Prog DesignVSH
(OCC)COMBINATION #3
185 0 0 180811 0 0 0 Prog DesignVSH
(OCC)COMBINATION #3
55 0 0 229374 0 0 0 Rigid +Z
310 1812 0 0 0 0 0 Flex XSNB
想对以上文本进行以下操作:
1.以(OCC)命名的行去掉重复行;
2.对数字行以第一个数字进行排序.
操作完成后的输出效果如下:
(OCC)COMBINATION #1
55 0 0 229210 0 0 0 Rigid +Z
310 1812 0 0 0 0 0 Flex XSNB
2740 43114 0 0 0 0 0 Rigid X
2780 0 70361 0 0 0 0 Rigid Y
2870 0 0 125519 0 0 0 Rigid +Z
5920 1477 4106 5995 11777 3365 6782 Displ. Reaction
(OCC)COMBINATION #2
50 0 0 128584 0 0 0 Prog DesignVSH
80 0 0 230385 0 0 0 Prog DesignVSH
5810 11683 60351 33718 50689 41126 56650 Displ. Reaction
5840 14139 61611 26507 44224 81387 127760 Displ. Reaction
5960 2673 2963 7167 11651 2569 5981 Displ. Reaction
(OCC)COMBINATION #3
55 0 0 229374 0 0 0 Rigid +Z
185 0 0 180811 0 0 0 Prog DesignVSH
310 1812 0 0 0 0 0 Flex XSNB
2460 0 0 60658 0 0 0 Prog DesignVSH
请问脚本应该如何考虑呢? 按ini方式读,用数组排序
页:
[1]