I have a property file with an entry such as this:
some.url={ipaddress}/blah
I want to substitute the {ipaddress} with the ip of machine its running on.
I found this command:
ipconfig getifaddr en0
which outputs the ip.
I also found sed is useful for this sort of thing but I can't quite put it all together.
sed -i '' 's/{ipaddress}/192.168.0.1/g' test.properties
Where the hard-coded ip address 192.168.0.1 needs to be substituted for the machine's one.
Can anyone help?
gat the end of this sed expression will cause all instances of "{ipaddress}" to be replaced. Make sure that is what you want. Or do you just want to replace the instance on lines that begin with "some.url="?