I need to change 's3_bucket': 'pass' to hello but it is not working
ex:
echo "'s3_bucket': 'pass'" | sed 's/'s3_bucket':/hello/'
outputs:
's3_bucket': 'pass'
Please help understand what am I doing wrong
I need to change 's3_bucket': 'pass' to hello but it is not working
ex:
echo "'s3_bucket': 'pass'" | sed 's/'s3_bucket':/hello/'
outputs:
's3_bucket': 'pass'
Please help understand what am I doing wrong
The quoting is wrong. The part 's/'s3_bucket':/hello/' is interpreted by the shell as 's/' followed by s3_bucket and ':/hello/', resulting in s/s3_bucket:/hello/ as an argument for sed.
Try
echo "'s3_bucket': 'pass'" | sed "s/'s3_bucket':/hello/"
or
echo "'s3_bucket': 'pass'" | sed 's/'\''s3_bucket'\'':/hello/'
Note that in the second version there are two adjacent single quotes in '\'', not a double quote.
There are more possible ways of quoting, see this answer to a similar question.