How to replace a parameter(variable) date value inside a text files daily with current date?

Hello All,

we what we call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below:

abc.txt
------------------

line1
line2
line3
$$EDWS_DATE_INSERT=08-27-2019
line4
$$EDWS_PREV_DATE_INSERT=08-26-2019

I am trying to write a small command that can update these dates daily with current date but its not replacing the date value.

sed -i 's/$$EDWS_DATE_INSERT =.*/$$EDWS_DATE_INSERT="$(date `+%y%m%d`)"/' abc.txt

current result: $$EDWS_DATE_INSERT="$(date `+%y%m%d`)"

can anyone help with this ?

Thanks in Advance!

Is this a duplicate post?

See example on other post:

sed -i 's/$$EDWS_DATE_INSERT *=.*/$$EDWS_DATE_INSERT='"$(date "+%y%m%d")"'/' abc.txt
1 Like