Escape character in Sed

Belaran

Registered
This is my script :

sed s/bob/"$VAR"/g

The trouble is VAR may contains a "/", and when there is one, it's interpreted by the BASH shell (and others) .

How can i fix this ?
 
The character you specify after the sed s command is the separator character. Using the / is not mandantory. If you prefer the pipe character | as separator you can simply write s|bob|"$VAR"|g.
 
Back
Top