0

By assigning the date to awk, I can get current date as following in yyyy-mm-dd:

awk -F, -v date="20$(date +%y-%m-%d)" '{print date}'

Output:

2019-02-17

Is there a way to add number of days to current date, let's say 7, so the output would be:

2019-02-24

Noting that using a method like below isn't providing the required output:

awk -F, -v date="20$(date +%y-%m-%d +7 days)" '{print date}'

Solution here is not providing same date format

Eng7
  • 1,681

1 Answers1

1

You can use format

date +%y-%m-%d --date="7 days"

to gate date after 7 days

And instead of adding 20 in front just use date on this way:

date=$(date +%Y-%m-%d --date="7 days")
Romeo Ninov
  • 17,484