In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Vim to delete even or odd rows in linux system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to delete even or odd rows using Vim in the linux system.
The method to delete even rows is as follows:
: G / ^ / + 1 d
The gbobal command is used above, and the gbobal command format is as follows:
: [range] global/ {pattern} / {command}
The global command is actually executed in two steps: first, all lines within the specified range of [range] are scanned to mark the lines that match {pattern}; then the {command} command is executed on the marked line in turn, and if the marked line is deleted, moved, or merged in the command operation on the previous matching line, the tag automatically disappears without executing the {command} command on the line. {command} can be an ex command or multiple ex commands separated by | so that we can do a variety of different operations on marked lines or rows addressed from marked lines.
The above command to delete even lines matches all lines and then deletes them interlaced (where + 1 is used to locate on the next line of the current line). Why is it interlaced? Because the second line is deleted when the + 1d command is executed on the first line, and although the second line is marked, it no longer exists, so the command to delete the third line will not be executed.
The command to delete several lines is as follows:
: G / ^ / d | m
The function of m is to remove the tag of even rows to prevent even rows from being deleted.
To delete even lines, you can also use the normal command, which is (the first command is the number of lines):
:% norm jkdd:%norm jdd so far, I believe you have a deeper understanding of "how to delete even or odd rows using Vim in the linux system". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.