Marco Linux Tutorial---Vim Editor advanced Lesson

Source: Internet
Author: User

1. Copy the/etc/rc.d/rc.sysinit file only in the/tmp directory, and add # at the beginning of the/tmp/rc.sysinit file with at least one whitespace character.

# Vim Rc.sysinit

In the last line mode of vim, enter:

%[email Protected]^[[:space:]]\{1,\}@#&@g

Match analysis:

%: The role is to do full-text matching, you can use 1,$ to replace;

@: Represents a delimiter, this can be replaced with other characters not appearing in this article;

^[[:space:]]:[[:space:]] = white space character, ^ indicates the beginning;

{1,}: matches at least 1 times the previous re character;

&: Represents all the content to which the reference is matched.

The special symbols in this regular expression are described below:

[: Alnum:]: represents English uppercase and lowercase characters and numbers, 0-9,a-z,a-z

[: Alpha:]: Represents any English uppercase or lowercase character, i.e. a-z,a-z

[: Upper:]: Represents a capital English character, A-Z

[: Lower:]: Represents a lowercase English character, which is a-Z

[:d Igit:]: Represents a number, that is, 0-9

[:p UNCT:]: To represent punctuation marks, that is "'"?!

[: Blank:]: Represents the space bar and TAB key

[: Space:]: Any character that generates whitespace, including the spacebar [TAB]CR, etc., [: blank:] is part of [: space:]

[: Graph:]: All but the space character (SPACEBAR and [Tab] key) All other keys, and [: blank:] the opposite?

[: Cntrl:]: All control keys, including Cr,lf,tab,del, etc.

[:p rint:]: All characters that can be printed out


2. Copy the/boot/grub/grub.conf to/tmp directory and delete the white space characters from the beginning of the/tmp/grub.conf file.

#cp/boot/grub/grub.conf &cd/tmp#vim grub.conf

Input in vim end-of-line mode

:%[email protected]^[[:space:]]@@g

3. Delete the/tmp/rc.sysinit file with # Starting with # and followed by at least one blank word lines # and white space characters

#vim/tmp/rc.sysinit

Vim input in the last line mode

:%[email protected]^#[[:space:]]\[email Protected]@g

4. The first three lines in the bit/tmp/grub.conf file are added with the # number at the beginning.

#vim/tmp/grub.conf

Vim input in the last line mode

: 1,[email protected]^.*@#&

5. Change the last 0 of all enabled=0 or gpgcheck=0 in the/etc/yum.repos.d/centos.media.repo file to 1.

#vim/etc/yum.repos.d/centos.media.repo

Vim last line mode input

:%[email protected]\ (enabled\|gpgcheck\) [email protected]\[email protected]

This article from "Product small stream, into Jianghai" blog, please be sure to keep this source http://goodjoe.blog.51cto.com/9173556/1826403

Marco Linux Tutorial---Vim Editor advanced Lesson

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.