歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux 如何用vim命令把編輯文件的幾行內容拷貝到一個新文件

Linux 如何用vim命令把編輯文件的幾行內容拷貝到一個新文件

日期:2017/2/28 15:58:20   编辑:Linux教程

在用vim編輯文件時,常常會用到一個功能:把編輯文件的幾行內容拷貝到一個新文件中。怎麼實現該功能?

假設編輯文件nginx.conf ,把該文件的51至91行拷貝到新文件./vhost/res.help.com.conf中,詳細實現,請參閱下面示例:

[plain]
  1. :51,91w!./vhost/res.help.com.conf

再拓展下,如何把nginx.conf 中的31到34行追加到文件./vhost/res.help.com.conf中,請參閱下面示例:

[plain]
  1. :31,34 w! >>./vhost/res.help.com.conf
Copyright © Linux教程網 All Rights Reserved