This action script should provide you a starting point (if we imagine the file is in c:\):
delete __appendfile appendfile { concatenation "%0D%0A" of (if it starts with "rest.protocol" then "#" & it else if it starts with "rest.port" then "#" & it else it) of lines of file "c:\ClientAgent.cfg" } appendfile rest.protocol=https appendfile rest.port=8082 delete "c:\ClientAgent.bak" move "c:\ClientAgent.cfg" "c:\ClientAgent.bak" move __appendfile "c:\ClientAgent.cfg
Line 2 is where the old port and protocol lines get commented out.
You can make it a fixlet by using something like this for the relevance:
exists file "c:\ClientAgent.cfg" whose (not exists line whose (it = "rest.protocol=https") of it or not exists line whose (it = "rest.port=8082") of it)
The *NIX version would be roughly the same but you’d change “%0D%0A” to “%0A” on line 2 to allow for the newline difference.
I have no HP-UX experience but where I’ve needed to create properties that cater for Windows / Linux / Mac OS and I try to use a standard approach to cater for supporting a mixture of OS’s within a single fixlet/property.
Firstly I would list out what paths you have for each OS then build a relevance statement that covers the pathname for each OS. For Windows, Linux / Mac I use this as a guideline
((if (windows of it) then (folder "WidowsPathHere") else (if(unix of it) then (If(name of it as lowercase contains "linux") then (folder "LinuxPathHere") else (folder "UnixPathHere")) else (if(mac of it) then ("MacPathHere") else (nothing)))) of operating system)
Then, build relevance to parse the file based on its format (assuming the format is common across the various OS). An example of parsing a common formed text file across OS like this can be seen in Universal append to hosts file which may help you construct something for your specific use case.
I have one more doubt here. in the ClientAgent.cfg file, if I want to add one line as SITE_CONTROLLER_ADDRESS=192.x.x.x
kindly note: I want to check one condition like whether we any line entry present SITE_CONTROLLER_ADDRESS=
( without any IP address assigned ) and add my new IP address .