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