I am trying to replace properties in a properties file using sed in a shell script; the command below works great
sed "s!${KEY}=.*!${KEY}=${NEWVAL}!" infile > outfile
Problem - this guy is also replacing the corresponding "KEY" in the comments.
file example:
script:
#!/bin/ksh KEY="ws.clients" NEWVAL="http://abcd.com" sed "s!${KEY}=.*!${KEY}=${NEWVAL}!" infile > outfile
exit:
I tried several ways, but could not escape the line starting with "#" ... sentences?
source share