4

Having the following in a file:

public $password = 'XYZ';

I'm trying to replace the password's value with a different one, through an automated deployment process from backup files.

I have the regext that will match the string above in a file, but not much compatible with sed

(public\s\$password\s=\s'(.*)'?)

I also tried

sed -i -e "s/public\s\$password\s=\s'(.*)'/private\s\$password\s=\s'jingle'" configuration.php

Any ideas?

1 Answer 1

5

Try this:

sed -i -e "s/public\s\$password\s=\s'\(.*\)'/private \$password = 'jingle'/" configuration.php

The problem was that you need to 'escape' the round brackets, and that \s doesn't work in the output pattern. You also had missed the final /.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.