Edit date entry inside a file

Hi All,

I wanted to edit the date value located at /var/opt/CPsuite-R65/fw1/conf/local.scv. The date entry looks like this :

:Signature (">=20100717")

How can I update the date value by 1 day every other day while preserving the margins of the whole file in a shell script? I have attached a portion of the file containing the date entry.

Thanks in advance for your help.

DATE=$(date +%Y%m%d)
sed '/Signature/s/=[0-9]*/='$DATE/ local.scv > new.scv
# (Look at new.scv to make sure it's what you want)
mv new.scv local.scv
sed '/Signature/s/=[0-9]\{8\}/='$DATE/  local.scv  > new.scv

Thanks guys for your response. This works. :slight_smile:

need help on editing the DATE value to one week ago. How can I do that on #!/bin/sh? Thanks again for any response.

Hi,

date --d '1 week ago' +%Y%m%d