Check the condition & Add the line - Action script required

I need to append IP address in the below configuration file .

sample config file :: Filename :: panacesagent.cfg

rest.protocol=https
rest.port=8082
SITE_CONTROLLER_ADDRESS=

Before that, I need to check one condition .

Condition :

panacesagent.cfg contains any line entry “SITE_CONTROLLER_ADDRESS=” (whether it’s already exists or not)

If file have exist entry of SITE_CONTROLLER_ADDRESS= then, add one IP address in the end of = sign ( SITE_CONTROLLER_ADDRESS= x.x.x.x)

else

If doesn’t have line entry ( “SITE_CONTROLLER_ADDRESS=” )

add one new line entry
append SITE_CONTROLLER_ADDRESS=x.x.x.x

We need to use parameter option for IP inputs .

We need to take a action on all AIX, Linux, Solaris & windows environment. ( common action required… Based on OS type, action has to trigger ).

Kindly help me .