getting a date illegal option after running a unix script

时间:2018-12-19 11:31:04

标签: shell date unix

tried to run the following script in Unix to display text with dates more than 30 days old than current date

awk -v threshold=$(date "--date=$(date) -30day" +%Y%m%d) -F "'" '$1 < threshold' myname.dat | wc -l

got the following error for dates in the format 2019-02-03 in the file myname.dat

date: illegal option -- -
Usage: date [-u] [+format]
   date [-u] [mmddhhmm[[cc]yy]]
   date [-a [-]sss.fff]

How to resolve?

0 个答案:

没有答案