I’d like a simple one liner with sed to update a java property value. Without knowing what the current setting of the java property is, and it may be empty)
before
example.java.property=previoussetting
after
example.java.property=desiredsetting
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming Linux Gnu sed, 1 solution would be
Edits escaped ‘.’ chars i.e.
s/example\.java.../per correct comment by KentIf you’re using BSD
sedon a Mac for instance, you’ll need to supply an argument to the-ito indicate the backup filename. Fortunately, you can useas an argument, and avoid having to manage
.bakfiles in your workflow. (BSDsedinfo added 2018-08-10)If your sed doesn’t honor the
-i, then you have to manage tmp files, i.e.I hope this helps.