I want to do something in a Shell script without adding a dependency, so have to rely on awk/sed.
Namely, I want to replace the content of a line in a file, without affecting the rest of the file. But I only know the start of the line. For example, the line might be
CURRENT_DATE 2020-03-02
or it can be
CURRENT_DATE 2019-04-01
Or any other date -t he only part I know is that it starts with CURRENT_DATE. And I want to put the actual current date there instead. And the line is in the middle of the file and no other lines should be affected.
So how do I do this? While sed is typical for replacements, I am kinda lost because of the required wildcard.
awk '/CURRENT_DATE/{$2="18-07-2020"}1' file