| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
>> Q. How to match the following PHP5 expression?
>>
>> $CONF['setup_password'] = 'changeme';
>
> The same regular expression should work for both:
>
> bash$ cat > config.php
> echo "Hello!"
> $CONF['setup_password'] = 'changeme';
> $CONF['something_else'] = 42
> ^D
> bash$ grep "^\$CONF\['setup_password']" config.php
> $CONF['setup_password'] = 'changeme';
> bash$ sed "/^\$CONF\['setup_password']/s/changeme/newpassword/" config.php
> echo "Hello!"
> $CONF['setup_password'] = 'newpassword';
> $CONF['something_else'] = 42
> bash$
Thank you! Almost got it! But I had used the ''' instead the '"' character just after the command sed. :(