Vim Editor Little Exercise

Source: Internet
Author: User
Tags expression engine



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


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.