Hello,
I have a bash script that I want to change all occurrences of jdk1.5.0_14 with jdk1.6.0_20 in a file
I have the following piece of code :
#!/bin/bash
myvar="jdk1.6.0_20"
sed "s/jdk1.*/$myvar/g" answer_file.1 > answer_file.2
However I have the following information in answer_file.1 (pasting the relevant part):
JDKSelection.directory.JDK_LIST=/usr/jdk/jdk1.5.0_14 (v. 1.5.0_14 by Sun Microsystems Inc.)
JDKSelection.directory.HIDDEN_JDK=/usr/jdk/jdk1.5.0_14
The code above changes the occurence of jdk1.5.0_14 to jdk1.6.0_20 but also removes the information contained in paranthesis in the first line.
So after the change, I need the answer_file.2 file look like this:
JDKSelection.directory.JDK_LIST=/usr/jdk/jdk1.6.0_20 (v. 1.6.0_20 by Sun Microsystems Inc.)
JDKSelection.directory.HIDDEN_JDK=/usr/jdk/jdk1.6.0_20
How can I achieve this?
Thanks for your answers....