Jayaprakash Nagarajan
Jayaprakash Nagarajan

Reputation: 89

how to use single quotes in replacement string using sed in linux?

I want to replace the below string

su - oracle -c "$agent_home/bin/emctl control agent runCollection ex01cel01:oracle_exadata oracle_exadata_configuration"

to replace with

su - oracle -c "'$agent_home'/bin/emctl control agent runCollection ex01cel01 :oracle_exadata oracle_exadata_configuration"

note:extra single quotes covering the $agent_home

Please help me

Upvotes: 0

Views: 271

Answers (1)

Peter Heitman
Peter Heitman

Reputation: 26

The following sed command should do it

sed "s|\$agent_home|'\$agent_home'|"

Upvotes: 1

Related Questions