sed error

hi guys!!

I am new to shell script..

here is what i want do, i want to search original string in export.txt file which is:
export mib =/opt/old_mib/

i want to replace it by
export mibs =/opt/new_mibs/

i tried

sed -e 's/export mib =/opt/old_mib//export mibs =/opt/new_mibs//g'

but its throwing an error

Please help me with it

thanks in advance

The "/" character is a part of the substitute command of sed, as well as that of your data, which is why sed balks.

Try something like:

sed 's#export mib =/opt/old_mib/#export mib = /opt/new_mibs/#'

Otherwise, escape each "/" character in your search and replacement strings.

tyler_durden

You would use a \ to escape a special character such as a / You'd put this before the special character. So you would escape it like this:

\/

Or

sed 's|export=/opt/old_mib/|export=/opt/new_mibs/|g'

-Devaraj Takhellambam

thanks guys!! your suggestion really helped :).