| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
On 2015-12-15 19:11, n22e113 [email protected] [sed-users] wrote:
>>> Q. How to match the following PHP5 expression?
>>
>> bash$ sed "/^\$CONF\['setup_password']/s/changeme/newpassword/" config.php
>> echo "Hello!"
>> $CONF['setup_password'] = 'newpassword';
>> $CONF['something_else'] = 42
>
> Thank you! Almost got it! But I had used the ''' instead the '"'
> character just after the command sed. :(
The above should work on most *nix shells. Windows does strange
things with quoting, so if you're working there, it would help to
know that.
Also note that the above is quoting quotes (the double-quotes are
quoting the single-quotes), so if you change the quotes, you may have
to also escape quotes inside the sed command/expression.
-tim