Memo CentOS uses SED to modify files

Source: Internet
Author: User

#全文搜索替换

Sed-i ' s/to search for string/replace string/g ' file name

#全文删除特定字串

Sed-i '/content to be deleted/d ' file name

#全文删除没有任何内容的空行 (that is, even the space does not press the type of direct carriage, such as a return to the kind of empty line. The use of the regular expression, ^1 said to start with 1, 3$ to the end of 3, if only ^$ is specifically to indicate that even the space does not have a carriage return line)

Sed-i '/^$/d ' file name


Memo CentOS uses SED to modify files

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.