Considering below file, how can I compare two timestamps, noting that the time part is negligible.
foo,boo,2038-01-18T12:00:00+02:00
foo,boo,2015-09-12T01:31:24+03:00
foo,boo,2015-08-04T03:15:38+03:00
I tried to make it by substring
the date using below code and compare it with other dates i.e: 2015-08-12
awk -F, '{$3=substr($3,1,10)}{if($3<2015-08-12){print $0}}'
But it did not work.
Desired output:
foo,boo,2015-08-04T03:15:38+03:00
OR:
foo,boo,2015-08-04
Best Answer
You need to double quote the date, to force string comparison: