Linux Command: Find & Replace using regex not woking as expected -
i trying replace path in php files using regex command, isn't working expected! i want replace '/home/example/public_html $_server['document_root'] . ' i using below command in ssh: find /var/www/advertise/ -name '*.php' -type f -exec sed -i 's/\'\/home\/example\/public_html/\$\_server\[\'document\_root\'\]\ \.\ \'/g' {} \; when enter command , hit return, > sign follows like: > > > .. on keep hitting return execute command. where below command works (for replacing home/example/public_html var/www ): find /var/www/advertise/ -name '*.php' -type f -exec sed -i 's/home\/example\/public_html/var\/www/g' {} \; you're messing quotes. use separator other / don't need escape / you don't need escape in replacement since have ' in replacement, better use "s#..#..#" (i.e. double quotes). however, you'll need escape $ in replacement prevent shel...