如何复制多行并在每行下分别粘贴多次?
How to copy multiple lines and paste multiple times under each line separately?
原文如下。我想复制每一行并在各自的行下分别粘贴n次。
USD
XYZ
ABC
YUT
LMO
.
.
. upto so on
想让他们变成这样。我怎样才能在 Vim?
中实现以下目标
USD
USD
USD
USD
USD
USD
XYZ
XYZ
XYZ
XYZ
XYZ
ABC
ABC
ABC
ABC
ABC
YUT
YUT
YUT
YUT
YUT
LMO
LMO
LMO
LMO
LMO
.
.
. upto so on
一个选项是 find/replace 整个文件
%s/.*/&\r&/gc
细分
%s start a substitute on the entire file
.* capture the entire line to be replaced
&\r& replace with the entire captured group. Add \r& as amount of required duplicates
使用 awk 过滤
:%!awk '{while(++i<257)print;i=0}'
参考:www.unix.com
原文如下。我想复制每一行并在各自的行下分别粘贴n次。
USD
XYZ
ABC
YUT
LMO
.
.
. upto so on
想让他们变成这样。我怎样才能在 Vim?
中实现以下目标USD
USD
USD
USD
USD
USD
XYZ
XYZ
XYZ
XYZ
XYZ
ABC
ABC
ABC
ABC
ABC
YUT
YUT
YUT
YUT
YUT
LMO
LMO
LMO
LMO
LMO
.
.
. upto so on
一个选项是 find/replace 整个文件
%s/.*/&\r&/gc
细分
%s start a substitute on the entire file
.* capture the entire line to be replaced
&\r& replace with the entire captured group. Add \r& as amount of required duplicates
使用 awk 过滤
:%!awk '{while(++i<257)print;i=0}'
参考:www.unix.com