I am trying to search for a text in a file and store it into a variable.
My file looks something like this:
Type: Furniture
Color: Blue
Version: 1
I am trying to search for the Version number and store it into a variable and increment it. This number is unknown to me when I am searching the file. So far I have something like this.
VERSIONNUMBER=//Somehow I want to get the version # from the file.
VERSIONNUMBER=`expr $VERSIONNUMBER + 1'
sed -i "s/Version:.*/Version=$VERSIONNUMBER/" filename
Am I on the right track so far or is there a better way of doing this? I'm having trouble searching for the version number. I keep getting syntax errors. Any help is much appreciated.
VERSIONNUMBER=`sed -i "s/Version:/*" filename`