Hello I am trying to make a script to edit chrome flags on mac using a bash script. This script is to set max SSL to TLS1.3 on chrome. However, I am having some issues with sed. Here is what my command looks like:
sed -i '.bak' -e 's/{\"browser\".*origin\":\"\"\}/\"browser\":\{\"enabled_labs_experiments\":\[\"ssl-version-max@2\"\],\"last_redirect_origin\":\"\"\}/g' "./Local State"
The goal is to append
"enabled_labs_experiments":["ssl-version-max@2"]
to this
{"browser":{"last_redirect_origin":""}
to make it looks like this
{"browser":{"enabled_labs_experiments":["ssl-version-max@2"],"last_redirect_origin":""}
Not sure what's wrong with my command but any help in achieving this is really appreciated or just pointing me in right direction would help greatly.
Thanks!
sed -i '.bak' -e 's|\(\"browser\"\):{\(\".*origin\":\"\"\)}|\1:{\"enabled_labs_experiments\":[\"ssl-version-max@2\"],\2}|'
The trick is to use the \( and \), to define two groups, and use \1 and \2 in your substitution to represent these groups. BTW, your curly brackets don't match in your examples...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With