在以下示例中,存在具有進行排序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