How can i replace a path with another path in file using sed command, And when it is used as a variable in script it is working.
sed -i "s/"system_filter = /etc/define_filter_file"/"system_filter = /usr/local/etc/file_regex"/g" /etc/exi.conf.bak
sed
How can i replace a path with another path in file using sed command, And when it is used as a variable in script it is working.
sed -i "s/"system_filter = /etc/define_filter_file"/"system_filter = /usr/local/etc/file_regex"/g" /etc/exi.conf.bak
Best Answer
You need to escape all slahes in the provided paths and change opening and terminating quotes to single quotes.
The command is expressed as:
Path1 and path2 can not clearly contains
/
as this will be confused with the whole expression.