Ok sorry,
I did not proceed with my problem until today.
I read a good site
http://www.grymoire.com/Unix/Sed.html#uh-0
now I have this and it works.
openvpn.conf looks like:
#remote 10.0.0.1 1941
remote mail.google.com 1900
#remote mail.google.com 1912
#remote mail.google.com 2301
It deletes old lines with the context google and insert a new one.
Also some duplicate lines are removed.
#!/bin/bash
sed -e '/^remote/s/remote/#remote/g
/remote.*google/d' openvpn.conf |uniq > tmp.txt
sed -e '/remote/a\
remote mail.google.com 2201
' tmp.txt > tmp1.txt
mv tmp1.txt openvpn.conf
rm tmp.txt
And I have a script to change ini file variables
for 0 to 1 like:
#!/bin/bash
sed -e'/Mode.*=/s/1/0/g
/StandAlone.*=/s/1/0/g
/PreSave.*=/s/1/0/g' Prog.ini > Prog.new
mv Prog.new Prog.ini
Maybe these scrips can be modified. However, have fun with it.
Thanks,
Peter