Tcanarchy
Tcanarchy

Reputation: 770

Understanding a Sed command

I am modifying some shell script and came across this command.

sed -i "[email protected]@$hostname@g" configuration.xml

I searched and found out the sed with s option is just a substitution. And the g at the end stands for global. But I can't find what @ symbol are for.

Can anybody explain the above command to me?

Thanks

Upvotes: 0

Views: 94

Answers (2)

Jotne
Jotne

Reputation: 41456

If you like to replace this:

/some data/

with this:

/some other/data

You can do this and escape the /

sed "s/\/some data\//\/some other\/data/g"

or change the / to some else:

sed "s@/some data/@/some other/data@g"

Upvotes: 2

kviiri
kviiri

Reputation: 3302

The symbol immediately following s is the command/argument delimiter. Traditionally, / is the most commonly used but it can be other symbols, like @ as well.

Upvotes: 5

Related Questions