In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, Xiaobian will share with you the relevant knowledge points on how to delete one or more lines of VIM content. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you will gain something after reading this article. Let's find out together.
Install vim#How to install vim in Ubuntu/Debian $ sudo apt install vim#How to install vim in RHEL/Centos #] yum -y install vim Delete a single line Move the cursor to the line you want to delete Press ESC to make sure you exit editing mode Press d twice on your keyboard to delete it. Delete all rows
Here are three ways to delete
The first way is to press ESC once to make sure you exit editing mode. Press G twice to move the cursor to the first line of text and then press D and G. The d key is lowercase and the G key should be switched to uppercase.
This way you can delete everything.
The second way is to press ESC to make sure you exit editing mode. Press the: colon key,(shift + ;) to type: colon. Then type 1,$d
The third way is to press ESC to make sure you exit editing mode. Press: colon, shift + ; to type: colon. Then type %d. % Represents all lines in a file. Delete multiple lines Move the cursor to the line you want to delete Press ESC to make sure you exit edit modePrefix dd with the number of lines you want to delete. For example, if you want to delete 3 rows below row 4, press 3 dd to delete row instance one of the given range.
If you want to delete a specified range of lines, such as lines 3 to 5, press ESC, then type the following command, and press Enter.
:3,5d Example 2
Delete the last line, press ESC, and then type the command below, then Enter.
:$d Example 3
Delete all rows preceding the current row
:1,.- 1d Example 4
Delete all rows after current row
:.+ 1,$d Delete row instance 1 by conditional matching
Delete lines containing text keyword
:g/text/d Example 2
Delete lines that do not contain the #keyword
:%g!/#/ d#or:v/#/d Example 3
Delete comments that start with #.
:g/^#/d Example 4
Delete all blank lines
:g/^$/d above is "VIM how to delete one or more lines of content" all the content of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.