I have a file which has a date at the beginning of each line. I want to get all lines which has a date that is less than the current date.
Here is what I have,
When I used this:
awk '$NF < "2020-10-27"' expiry.txt >sample.txt
I was able to get a desired output
But when I substitute the date above "2020-10-27" to date today , I got no result
My script:
date=$(date '+%Y-%m-%d')
awk '$NF < "$date"' expiry.txt
sample logs in the file
2020-05-30: /tmp/abcd
2019-08-21: /tmp/abcde
2020-03-22: /tmp/abcdef
Thanks