Solved Find & Replace All Text After a Specific Character

Sorry to have to post this, but I'm at my wits end with this. I've gotten close, but no cigar. Lots of examples that work on Linux, not much for BSD.

I have a file, app.properties, and in the middle of the file is a line

spring.data.cassandra.contact-points=<insert random IP here>

I need to put the current machines IP (which I've captured in a varaible $hostip) after that equal sign. Basically, everything after the equal sign needs to be replaced with my handy dandy $hostip value.

This works, but doesn't remove the existing IP, it just keeps appending. So, this must be close, where am I going wrong?

sudo sed -i '' "s/spring.data.cassandra.contact-points=*/spring.data.cassandra.contact-points=$hostip/g" app.properties

I should also mention that I suck at sed, so there's that.
 
Back
Top