1

Hi I want to replace a part of my /etc/sysconfig/file It consists:

OPTIONS='--para'

CERT_PATH=/etc/cert

I want to replace OPTIONS='--para' by OPTIONS='--para --para2 172.0.0.0/16'

So I tried:

sudo sed -i 's/"OPTIONS='--para'"/"`OPTIONS='--para --para2 172.0.0.0/16'"/' /etc/sysconfig/file

But the error:

edit the /etc/sysconfig/file
sed: -e expression #1, char 88: unknown option to `s'

Can someone help me to correct this sed-command

1 Answers1

0

Try this:

sudo sed -i "s#OPTIONS='--para'#OPTIONS='--para --para2 172.0.0.0/16'#" /etc/sysconfig/file
Jahid
  • 21,542
  • 10
  • 90
  • 108
  • tried it, it gave no error but there wasn't a change. I only saw the output of the original file –  Jan 28 '16 at 13:11
  • Add back the `-i` option to do in-place edits. – tripleee Jan 28 '16 at 13:15
  • @Jenson you need the -i flag along with the sudo. I didn't test the above command and thus avoided the -i flag as you will be testing it first. Now I have tested it and added both sudo and -i. – Jahid Jan 28 '16 at 13:18
  • Thanks, the ip contains a '/' which I did not saw. That was the reason it wasn't working –  Jan 28 '16 at 13:22