Find and Replace Path in UNIX

Hi All,

How can i find and replace the one path to another path with in the file.

For Example:

Search_path=/search/path
replace_path=/replace/path

I used the following command but not usefull, please help me regarding the same.

sed 's_/search/path_/replace/path_' file_name > tmp_file.txt

Why is that not useful, what result do you get?

I am getting following error...

sed: command garbled:

Search_path=/search/path_old

replace_path=/replace/path_new

Strange, your command works perfectly for me...

Syntax:

sed 's_/search/path_old_/replace/path_new/_' ttt.txt > tmp.txt

Error:

sed: command garbled: s_/search/path_old_/replace/path_new/_

Above systax is not working for me, please help me.

---------- Post updated at 04:30 AM ---------- Previous update was at 04:25 AM ----------

Please any once can help me....

Now this is clear - you did not post the offending command in post#1.

sed: command garbled: s_/search/path_old_/replace/path_new/_
 

cannot interpret the substitute command as your separator "_" also exists in your patterns! Replace separator by ":" and it flies.

Thanks alot RUDIC, its working now.