0

I am trying to replace parameters in a config file using sed. The parameters are clearly marked as "". I'm trying to change

answer: <YOUR ANSWER HERE>

to

answer: answer

My sed command:

sed -i '/s/<ADD ANSWER HERE>/answer/' config.yaml

error is

sed: -e expression #1, char 4: unknown command: `<'

I've tried using " and escaping with \<

6

You simply have an extra / at the beginning, which confused sed into thinking that you want to perform a command (called <) on a line that matches the pattern /s/. Instead, use:

sed -i 's/<ADD ANSWER HERE>/answer/' config.yaml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.