Where it's going wrong is the way the last part is quoted:
sed 's/multiline.pattern: \^\\\[/multiline.pattern: '\'\^\\\\[\'/g'
# ^ ^ ^ ?
That last part is
backslash escaped until the end where another single quote was opened. That's why
bash gave the
>, allowing you to type in more stuff until the quote is closed with another
Remove that last
' and it will work:
sed 's/multiline.pattern: \^\\\[/multiline.pattern: '\'\^\\\\[\'/g
sed 's/multiline.pattern: ^\\\[/multiline.pattern: '"'^\\\['/g"
sed "s/multiline.pattern: ^\\\\\[/multiline.pattern: '^\\\['/g"
sed 's/multiline.pattern: ^\\\[/multiline.pattern: \x27^\\[\x27/g'
- From your example output, it seems that you want to remove the
# as well. To do so, include it in the matching pattern for
sed (using whichever quoting style you prefer):
- It's possible to use brackets to "catch" parts of your matching pattern, so that you can reuse those parts in the substitution (called subexpressions & back-references):
sed -r 's/#(multiline\.pattern: )(\^\\\[)/\1'\'\\2\'/g
--regexp-extended isn't necessary for that, but it's more readable)
- It's best to check that your
sed command is functioning as intended by first running it without the
--in-place option so the output can be checked for errors, instead of overwriting the file with potential errors.