I am trying to read the value from a property file and capture the value into a variable. My property file is a key value pair separted by '=' sign. So in script I replace the values before '=' with empty space and I get the value. Now I have a problem where my value apart also contains '=' sign and when I execute the script my data becomes null. Below is the code i use.
My Property file entry is
Could anyone let me know how to replace only the first occurence of the string?
SCJP | SCWCD | OCA
Joined: Aug 27, 2012
Your expression looks more complex than I would expect but to deal with the immediate problem I think you need to make the second sed expression use a reluctant .* . i.e. 's/^.*?=//' . Does 'sed' allow reluctant qualifiers ? Doesn't seem to !
Edit : Since 'sed' does not seem to support reluctant qualifiers I created a perl version -