在以下示例中,存在具有进行排序3个元素:形成单个单元如何对行组进行排序?
- “[AAA]”和4线(总是4)在其下方。
- “[kkk]”和它下面的4行(总是4)组成一个单元。
- “[zzz]”和它下面的4行(总是4)组成一个单元。
只有以下这个图案线的基团应该被排序;必须保留“[aaa]”之前和“[zzz]”第4行之后的任何内容。
来自:
This sentence and everything above it should not be sorted.
[zzz]
some
random
text
here
[aaa]
bla
blo
blu
bli
[kkk]
1
44
2
88
And neither should this one and everything below it.
到:
This sentence and everything above it should not be sorted.
[aaa]
bla
blo
blu
bli
[kkk]
1
44
2
88
[zzz]
some
random
text
here
And neither should this one and everything below it.
多么可怕的例子..你为什么对所有的部分都有相同的值?注意:我会使用'awk'。 –
编辑:现在应该更容易理解。 – octosquidopus
是的,在说明数据前后都是如此。祝你好运。 – shellter