Vim replacement, interception, and append operations

Source: Internet
Author: User

Reference:

    • http://blog.csdn.net/love__coder/article/details/6739670
    • http://blog.csdn.net/love__coder/article/details/7217377

Intercept to generate a new file or append to an existing file:

:up to aw!./new.txt             #将第21 ~42 line to generate new.txt under the same path:Max,w! >>./ AnotherNew.txt    #将第43 ~52 Row appended to anotherNew.txt under T same path    

Replace:

: s/old/New           #替换当前行的第一个old为new: s/old/new/g         #替换当前行的所有的old为new:., $s/old/New        # Replace the current line to the first old of the last row for new:., $s/old/new/g      #替换当前行到最后行的所有old为new: N,ms/old/New        # Replace the nth row to the first old of row m of New:n,ms/old/new/g      #替换第N行到第M行的所有old为new: N,ms/old/new/GC     # Replace all old of row N to line m with new, and ask for the deletion individually:%s/old/new          #替换所有行的第一个old为new:%s/old/new/g        # Replace all old for all rows with new

Vim replacement, interception, and append operations

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.