lundi 13 février 2017

Sed: How to insert a pattern which includes single ticks?

Vote count: 0

I'm trying to use sed to replace a specific line within a configuration file:

The pattern for the line I want to replace is:

ALLOWED_HOSTS.*

The text I want to insert is:

'$PublicIP' (Including the single ticks)

But when I run the command:

sed 's/ALLOWED_HOSTS.*/ALLOWED_HOSTS = ['$PublicIP']/g' /root/project/django/mysite/mysite/settings.py

The line is changed to:

ALLOWED_HOSTS = [1.1.1.1]

instead of:

ALLOWED_HOSTS = ['1.1.1.1']

How shall I edit the command to include the single ticks as well?

asked 21 secs ago

Let's block ads! (Why?)



Sed: How to insert a pattern which includes single ticks?

Aucun commentaire:

Enregistrer un commentaire