I'd like to change the IP address in this string with some user input:
rmi.sceduling.service.url=rmi\://192.168.0.19\:1199/ScedulingService
The code should also work if there is no address:
rmi.sceduling.service.url=
It should also be portable, at least to Solaris.
The code I am using at the moment:
value=`grep 'rmi' application.properties \
| awk -F":" '{print $2}' \
| awk -F"\'" '{print $1}'
| cut -d '/' -f 3-5 `
sed -e "s/$value/$host_ip/g" application.properties > file.tmp \
&& mv file.tmp application.properties
Here's a naïve solution:
A portable solution that should work on both solaris and ubuntu
Why are you doing all these edits (in this and several of your other recent questions) on this application.properties file anyway? Seems to me that just writing that file from scratch would be much easier.