- 论坛徽章:
- 0
|
在Solaris 中实验如下:
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
成功,达到要求....
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
缺少一行哟 ..... 没有达到要求。
sed -e '2,5{2h;2!H}' -e '7G' file
sed -n -e '2,5{2h;2!H}' -e '6,${7G;p}' file
各位大侠,能不能把这两个命令行,做一下解释说明工作? 谢谢 |
|