I need to search a value inside a file with this format:
key1=value1
key2=value2
Note: the value can have spaces.
I need to obtain the value of the key with a shell script.
I have this code:
myfile="./app.properties"
keyToSearch="EXAMPLE"
value=""
if [ -f "$myfile" ]
then
echo "$myfile found."
#Search the keyToSearch and obtain the value.
else
echo "$myfile not found."
fi
How I can search the key and obtain the value? For example with a while/do or similar.
Thanks!