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
  • 90,214
  • 20
  • 145
  • 172
kittygirl
  • 2,099
  • 2
  • 15
  • 38

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
  • 90,214
  • 20
  • 145
  • 172