I am new in using sed command and I have an sql which contains "MONYY" and I want to change the "MONYY" in the file by replacing it with the current "MONYY" automatically.
I have used the following command and I am able to get previous month and year and current month and year in uppercase and now I am trying to replace the values in my script using sed command but nothing is happening.
date1=$ date +"%b%y"|sed 's/\(.*\)/\U\1/'
echo $date1
date2=$ date -d ' -1 month ' +"%b%y"|sed 's/\(.*\)/\U\1/'
echo $date2
sed 's/$date1/$date2/g' aggdom.sql > temp
Can anyone help me out with the sed command that I am using