2
source=<!--jta-data-source>jdbc/FCBDataSource</jta-data-source-->

destination=<jta-data-source>jdbc/FCBDataSource</jta-data-source>


sed -i "s/$source/$destination/g" /home/rohan/R2.5LZN/UIReleasedArea/obp.ui.domain/persistence.xml

I am getting error sed: -e expression #1, char 44: unknown option to s

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
Rohan Gala
  • 641
  • 5
  • 18

2 Answers2

1

Consider what happens when the substitution occurs. The command becomes:

sed -i 's/<!--jta-data-source>jdbc/FCBDataSource</jta-data-source-->/<jta-data-source>jdbc/FCBDataSource</jta-data-source>/g' some_filename

Then, sed sees s/<!--jta-data-source>jdbc/FCBDataSource</j… and thinks that you want to replace an occurrence of <!--jta-data-source>jdbc with the text FCBDataSource<, and the s command has an illegal j modifier (and other junk).

You need to pick a delimiter character that does not appear in either the pattern or the replacement text. A , will do.

200_success
  • 7,286
  • 1
  • 43
  • 74
0
destination='<!--jta-data-source>jdbc/FCBDataSource</jta-data-source-->'
source='<jta-data-source>jdbc/FCBDataSource</jta-data-source>'


sed -i "s,$source,$destination,g"     
/home/rohan/R2.5LZN/UIReleasedArea/obp.ui.domain/persistence.xml

The problem was with the variable

Quotes were required

Rohan Gala
  • 641
  • 5
  • 18