在Vi中将内容从一个文件复制并粘贴到另一个文件

编程入门 行业动态 更新时间:2024-10-17 11:26:28
本文介绍了在Vi中将内容从一个文件复制并粘贴到另一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在处理两个文件,我需要从一个文件复制几行并粘贴到另一个文件中。我知道如何在同一文件中复制(yy)和粘贴(p)。但这不适用于其他文件。

I am working with two files, and I need to copy a few lines from one file and paste into another file. I know how to copy (yy) and paste (p) in the same file. But that doesn't work for different files. How is this done?

还有,有什么方法可以剪切粘贴吗?我已经尝试过使用Google搜索,但是大多数资源都只讲复制粘贴。

Also, is there a way to cut-paste? I have tried googling, but most of the resources only talk about copy-paste.

推荐答案

因为您已经知道如何剪切/删除文本,以下是将其粘贴回另一个文件的一些想法:

Since you already know how to cut/yank text, here are a few ideas for pasting it back into another file:

  • 编辑第一个文件,提取所需的文本。然后从vi中打开第二个文件(:e / path / to / other / file )并粘贴
  • 在拆分窗口中一起打开两个文件,然后使用 Ctrl + w , Up / Down 在两个文件之间导航:

  • Edit the first file, yanking the text you want. Then open your second file from within vi (:e /path/to/other/file) and paste it
  • Open both files together in a split window and navigate between them using Ctrl + w, Up/Down either by:

  • vi -o / path / to / file1 / path / to / file2
  • 在第一个文件中, Ctrl + w , s
  • vi -o /path/to/file1 /path/to/file2
  • From within the first file, Ctrl + w, s

更多推荐

在Vi中将内容从一个文件复制并粘贴到另一个文件

本文发布于:2023-11-28 14:15:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642742.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   中将   内容   Vi

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!