I have sed statement to replace few contents in my file. It is taking a backup copu with the name file.bak
before replacing the content.
sed -i.bak -r "s#^(.*/abc_def_APP/).*(/application1\.war.*)#\1$version1/$version2\2#" /path/file
But I want the file to be backed up with current date. something like file.071913
How can I get it?
Since we have date "+%m%d%y"
that returns MMDDYY (month day year):
$ date "+%m%d%y"
071913
What about saying sed -i.$(this command)
so you have the following?
sed -i.$(date "+%m%d%y") -r .... file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With