Reputation: 651
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
Upvotes: 2
Views: 292
Reputation: 7582
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.
Upvotes: 1
Reputation: 651
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
Upvotes: 0