Reputation: 39
The file index.jsp contains this string:
'+sessionServerId + '' + countryAssetsInternationalization;
I need to replace it with this:
'+sessionServerId + '' + countryAssetsInternationalization+'&gameServer=https://webserver.com&gameAssets=';
I try a lot of possibilities with no results.
sed -i 's/\'\+sessionServerId \+ \'\' \+ countryAssetsInternationalization;/\'\+sessionServerId \+ \'\' \+ countryAssetsInternationalization\+\'\&gameServer=https:\/\/webserver.com&gameAssets=\';/g' index.jsp
Can you help me? Thank you!
SOLVED:
sed -i 's/\+ countryAssetsInternationalization;/\+ countryAssetsInternationalization\+'\''&gameServer=https:\/\/webserver.com\&gameAssets='\'';/g' index.jsp
Upvotes: 0
Views: 108
Reputation: 39
I can solve my problem myself:
sed -i 's/\+ countryAssetsInternationalization;/\+ countryAssetsInternationalization\+'\''&gameServer=https:\/\/webserver.com\&gameAssets='\'';/g' index.jsp
Upvotes: 2
Reputation: 17169
I am afraid \
is not reliable as a quote character in sed. Replace \'
and \+
with [']
and [+]
and it seems to start working.
sed "s/['][+]sessionServerId [+] [']['] [+] countryAssetsInternationalization;/\'\+sessionServerId \+ \'\' \+ countryAssetsInternationalization\+\'\&gameServer=https:\/\/webserver.com&gameAssets=\';/g" index.jsp
Upvotes: 0