Sed replaces the content in the text

Source: Internet
Author: User
Using sed to replace the content in the text with linux shell is very powerful. Using the sed command, you can easily replace the content in the file with what you want. For example, there is a test file named "test", in which xxx is used as the content to be replaced. Helloworld! Thisisadocument... sed replacing the content in the text with linux shell is a very powerful thing. Using the sed command, you can easily replace the content in the file with what you want. For example, there is a test file named "test", in which xxx is used as the content to be replaced. Hello world! This is a document that used to test sed! Here I have a simbol xxx, the simbol xxx is a location used to be replaced. replace xxx in the above file with the date sed-e "s/xxx/'date-d" 1 day ago "+ % Y % m % d'/g"> testsedresult the result is hello world! This is a document that used to test sed! Here I have a simbol 20130825, the simbol 20130825 is a location used to be replaced. the string "s/source content/target content/g" followed by sed indicates the replaced content. you can also use a regular expression to match the source content.
 

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.