Replacing a row record in a property file with a shell script

Source: Internet
Author: User

Replacing a row record in a property file with a shell script


Hypothetical as subordinate file Demo.properties


User.name=test

user.password=123456


...............................

Requirements: First you need to replace the value values of User.Name and User.password with the actual username and password through the shell script.

will be implemented in the following ways:


Sed-i "s#^user.name=.* #user. Name= username #g" Path/demo.properties

Sed-i "s#^user.password=.* #user. password= password #g" path/demo.properties


The contents of the demo properties file are replaced.


On the DSL language sed, the specific usage can be searched by self-study.

The next article describes how to replace a row record in the XML, which is more complicated than replacing a property file.


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.