0

I wanto replace # SigningTable refile:/etc/opendkim/SigningTable to SigningTable refile:/etc/opendkim/SigningTable. Which means just remove #.
I use sed -i 's/# SigningTable refile:/etc/opendkim/SigningTable/ SigningTable refile:/etc/opendkim/SigningTable/g' /etc/opendkim.conf,but doesn't work.
I think it's because /,how to use sed to replace string with /?

perreal
  • 94,503
  • 21
  • 155
  • 181
kittygirl
  • 2,255
  • 5
  • 24
  • 52

1 Answers1

1

You can change the delimiter:

sed -i 's!TEXT!REPLACE!' file

You can use this, if SigningTable appears once in the file:

sed '/SigningTable/{s/^# *//}' in

or be more specific:

sed '\@refile:/etc/opendkim/SigningTable@{s/^#//}' in
perreal
  • 94,503
  • 21
  • 155
  • 181