- 論壇徽章:
- 0
|
在Solaris 中實(shí)驗(yàn)如下:
root@application # cat file
Line one is 1
The second is line 2
That is the third line 3
the fourth is line 4
five line 5
Sixth is a line 6
This is seven Line 7
Right eigth line 8
That is ninth Line 9
The line is ten 10
last line is the last line 11
root@application # sed -e '2,5{2h;2!H}' -e '7G' file
Line one is 1
The second is line 2
That is the third line 3
the fourth is line 4
five line 5
Sixth is a line 6
This is seven Line 7
The second is line 2
That is the third line 3
the fourth is line 4
five line 5
Right eigth line 8
That is ninth Line 9
The line is ten 10
last line is the last line 11
成功,達(dá)到要求....
root@application # sed -n -e '2,5{2h;2!H}' -e '6,${7G;p}' file
Sixth is a line 6
This is seven Line 7
The second is line 2
That is the third line 3
the fourth is line 4
five line 5
Right eigth line 8
That is ninth Line 9
The line is ten 10
last line is the last line 11
缺少一行喲 ..... 沒有達(dá)到要求。
sed -e '2,5{2h;2!H}' -e '7G' file
sed -n -e '2,5{2h;2!H}' -e '6,${7G;p}' file
各位大俠,能不能把這兩個(gè)命令行,做一下解釋說明工作? 謝謝 |
|