1. Copy the/ETC/GRUB2.CFG to/tmp directory and use the Find and replace command to delete the white space character at the beginning of each line in the/tmp/grub2.cfg file
2. Copy the/etc/rc.d/init.d/functions to/tmp/directory and add a # number to the beginning of the line beginning with a blank character for each line of the/etc/rc.d/init.d/functions with the Find replacement command
3. Copy the/etc/init.d/functions file to the/tmp directory, replace the/etc/sysconfig/init path in the/tmp/functions file with the/var/log
4. Delete the # number at the beginning of all lines in the/tmp/functions file that begin with # and have at least one blank character after #
1. Copy the/ETC/GRUB2.CFG to/tmp directory and use the Find and replace command to delete the white space character at the beginning of each line in the/tmp/grub2.cfg file
1, copy / etc / grub2.cfg to / tmp directory ා install-m 644 / etc / grub2.cfg/tmp ා target exists, for directory, copy remains original ා ls-l / TMP / grub2.cfg-rw-r -- R -- 1 root r oot 5853 June one 18:37 / TMP / grub2.cfg
2./tmp/grub2.cfg for file # file/tmp/grub2.cfg/tmp/grub2.cfg:ascii text
3. Use the Find and replace command to delete the white space character at the beginning of each line in the/tmp/grub2.cfg file # vim +/^[[:space:]]\\+/tmp/grub2.cfg enters the file, Call the extension regular expression engine, just meta characters different 1, sed default to full-text scan 2, delimitation, will also be full-text scan, just processing bound line g: There are multiple matches in a row, replace all, here mode, only one, there is g no G no difference
2. Copy the/etc/rc.d/init.d/functions to/tmp/directory and add a # number to the beginning of the line beginning with a blank character for each line of the/etc/rc.d/init.d/functions with the Find replacement command
1. Copy/etc/rc.d/init.d/functions to/tmp/directory # cp/etc/rc.d/init.d/functions/tmp# ls-l/tmp/functions-rw-r--r--1 root root 1 5131 June 18:49/tmp/functions
2. Add a # number to the beginning of the line beginning with a blank character for each line of the/etc/rc.d/init.d/functions that replaces the command:%[email protected]^[[:space:]]\[email protected]#&@ # sed ' [email protected]^[[:space:]]\[email protected]#&@ '/tmp/functions with vim usage
3. Copy the/etc/init.d/functions file to the/tmp directory, replace the/etc/sysconfig/init path in the/tmp/functions file with the/var/log
1. Copy/etc/init.d/functions file to/tmp directory # install-m 600/ETC/RC.D/INIT.D/FUNCTIONS/TMP/FILE.TXT2, replace/tmp/functions file Etc/sysconfig/init path is/var/log:%[email protected]/etc/sysconfig/[email Protected]/var/[email protected]
4. Delete the # number at the beginning of all lines in the/tmp/functions file that begin with # and have at least one blank character after #
:%[email protected]^#\ ([[: Space:]]\+\) @\[email protected]
This article is from the "Reading" blog, make sure to keep this source http://sonlich.blog.51cto.com/12825953/1953292
Vim Editor Little Exercise