我需要在每行下方使用'vi'和/或'sed'编辑器插入一段文本。需要被插入各线下方的文本的块如下(表示一个空行):使用vi和/或sed编辑器插入每行下方的文本块
first line.
second line.
...
n-th line.
<empty line>
插入之前,文本看起来像如下:
This is the first line.
This is the second line.
...
This is the last line.
插入后,将文字将如下所示:
This is the first line.
first line.
second line.
...
n-th line.
<empty line>
This is the second line.
first line.
second line.
...
n-th line.
<empty line>
...
This is the last line.
first line.
second line.
...
n-th line.
<empty line>
有人吗?谢谢。
这工作很好,除了我必须管输出到一个文件或添加** - 我**开关,即* sed -i -r'/ ^/r块'文件*,覆盖现有的文件。谢谢。 – Mazilo 2014-11-10 04:25:42