Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 linux 服务器上使用 gvim 作为我的文本编辑器。我有一个大文件,大约 10K 行。
我需要选择n行数;例如,行512到1034并用另一行替换它们。我怎样才能做到这一点?
n
512
1034
如果其他行在文件中,您可以执行以下操作。
:512,1034d | r <filename>
512,1034指定从第 512 行到第 1034 行的范围。 d删除该行
512,1034
d
删除这些行后,您将第<filename>512 行的内容放在r或read
<filename>
r
read
如果内容在"寄存器中(就像您拉动内容一样),您可以使用
"
:512,1034p
"用寄存器的内容替换这些行。
选择特定行并使用nj命令 wheren是您要跳转的行数。
nj