- 论坛徽章:
- 0
|
如果想把多个sed命令放到同一行,那么可以使用分号(;)来分割这些命令~能举个例子吗?- daya@daya-desktop:~/sed$ cat new
- Line one.
- The second line.
- The third.
- This is line four.
- Five.
- This is sixth sentence.
- This is line seven.
- Eighth and last.
复制代码- daya@daya-desktop:~/sed$ sed '2 a\123
- > 4 a\456' new
- Line one.
- The second line.
- 123
- The third.
- This is line four.
- 456
- Five.
- This is sixth sentence.
- This is line seven.
- Eighth and last.
复制代码 我在第二行和第四行后面分别添加123,456,现在该如何把它们写在同一行呢?谢谢~- daya@daya-desktop:~/sed$ sed '2 a\123 ; a \456' new
- Line one.
- The second line.
- 123 ; a 456
- The third.
- This is line four.
- Five.
- This is sixth sentence.
- This is line seven.
- Eighth and last.
复制代码 |
|