Michael Hegner Michael Hegner - 2 months ago 7
Bash Question

Shell Script Edit Files Line

I am not that good on linux shell script and I need little help.

I want to edit a file via script (finding the line and edit).

The Original line is:

# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=< hostname >"

I want to uncomment and replaye hostname with

JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname="


You can refer to the set command, change the filename with the name you are working at,

sed -i 's@# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=< hostname >"@JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname="@' filename