First, as
Turbocapitalist said above it's matter of quoting. The space between green and red is not quoted. Neither is the space between red and magenta. Everything after the first unquoted space is considered by sed to be file names.
Code:
sed -i 's^\<constring\>\s*:.*^contring : \['1\|\|sS3kEuT24A1rE3hT5U_fWcYJa4y7KxmgJYYg5Ms8eBxRqMvphym7sz4M-Wmdt5AMbsrELTxW7Ng1U4mDRms0_JQ3LIqppYm8qb1k57_MeOv7LPU20v7pYyNPakDBf0mL1JixPIGk7oUGAZwfQCnSrqzhSDGz-7jek6wPWXMVq13_6pbUJSoo1J-mD5NwfKvqBHRZeJzaIuCenqv7KuWST9VrgIc6ZKAm3CLKC5Gb2gT5lnnqlGG373reml6KaIev7j0UbFecbKfWBY7A==, logs', '1\|\|hlt81VYLBRFCQnhCi1dGxci3-GCnBoe2Ke_qZ7LX7BIZEBYWNzWcuO9FhaW3XqpC_NskrD4RGe3ApyRBu4Rm-cIqqolP9aMt9h56W-TtMxWDXpja6h-aAzYmed51aAVP_jMRd_zarI0jbHfzlENWfpTJlSzDaxV4NJJNgCgCW2cDKoH4vqC8CwxxHpL_LKo8HkS13ZoyDpVsuAUYlwiBj5xmsPlXPwfQBTqoZxVFCGq18vWB7zpXaZ6W09wSS=, log1'\]^gi' file.yml
Second, using
^ to quote pattern for the
s command is unwise and confusing because
^ has a special meaning in RE: anchor for the start of line.
Third, if it's YAML then parse it with
yq rather than with sed.