This might work for you (GNU sed):
sed -i '\#\$settings\['\''file_temp_path'\''\] = '\''\.\./tmp'\'';#d' file
When the regexp/replacement contains the match delimiter (usually /
), it can either be escaped/quoted or the delimiters can be altered i.e. /\/tmp/
or \#/tmp#
. Note that in the case of the substitution command s/\/tmp/replacement/
can also be s#/tmp#replacement#
and leading delimiter does not need to escaped/quoted.
Meta characters i.e. ^
,$
,[
,]
,*
,.
,\
and &
must be escaped/quoted by \
or placed in a character class e.g. .
should be \.
or [.]
.
As a rule of thumb, sed commands should be enclosed in single quotes '
and for single quotes to be included in the regexp they should be replaced by '\''
which closes off the existing commands, shell escapes/quotes a '
and reopens the next sed command.
Using double quotes "
may also be used but may have unexpected side effects as they are open to shell interpolation.
N.B. If the regexp/substitution delimiter is put inside a character class it does not need to be escaped/quoted i.e. if /
is the delimiter then [/]
is the same as \/
. Also note, that {
,}
,|
,?
and +
should not be escaped/quoted if they are to represent their literal value unless the -E
or -r
sed command line option is invoked, in which case they should be i.e +
represents the plus sign as does \+
when the -E
is invoked, whereas \+
and +
when the -E
or -r
is invoked represent one or more of the preceding character/group.