1

I have to replace the following value in all the xml files so the value is

tcp://pondevpms1.fm.rbsgrp.net:6033,pondevpms2.fm.rbsgrp.net:6033

and the value with it need to be replaces is shown below

tcp://pondevpms1:3063

so i have fired the below command inside the directory that contain all the xml's

sed -i 's/tcp://pondevpms1.fm.rbsgrp.net:6033,pondevpms2.fm.rbsgrp.net:6033/tcp://pondevpms1:6063 /g' *.xml

but i am getting this below error please advise what is missing ..?

below the error that i am getting rite now

sed: -e expression #1, char 9: unknown option to `s'
dgfd hgfhg
  • 105
  • 1
  • 8

3 Answers3

1

I think you should change your delimiter from / to something else like # So your command would look like this

sed -i 's#tcp://pondevpms1.fm.rbsgrp.net:6033,pondevpms2.fm.rbsgrp.net:6033#tcp://pondevpms1:6063#g' *.xml

Alternatively, you could escape all your slashes, but that wouldn't look very nice

user2393256
  • 1,001
  • 1
  • 15
  • 26
1

You forgot to add the error, but I would bet that the slashes in your text are causing you trouble. Since you are using / as the sed operator you need to escape it in your text : \/ for every /.

However, since your text has alot of slashes and sed can use other characters as the operator, I would just use a pipe as the sed operator;

sed -i 's|tcp://pondevpms1.fm.rbsgrp.net:6033,pondevpms2.fm.rbsgrp.net:6033|tcp://pondevpms1:6063 |g' *.xml
Dan
  • 10,614
  • 5
  • 24
  • 35
1

Your expression is incorrect. You can use any separator, so avoid '/' as it conflicts with the contents, I personally use # because it is seldom used except in comments.

sed -i 's#tcp://pondevpms1.fm.rbsgrp.net:6033,pondevpms2.fm.rbsgrp.net:6033#tcp://pondevpms1:6063#g' *.xml
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219