dimanche 29 mars 2015

If string is less than date yields all dates or none

I have a log file with a custom date format, in which I'm pulling out the dates to see if they preceed a certain time period, and if so to print them. Unfortunately I can only get it to print everything or nothing.



deldate=$(date +"%m/%d/%Y %T" -d "-92 hours")
awk '{ if ("$6 $7" < "$deldate") print $6, $7}' srbilltest.txt
echo "Delete Date:" $deldate;


Source file example.



field1 field2 field3 field4 field5 3/24/2015 1:42:00
field1 field2 field3 field4 field5 3/25/2015 1:42:00
field1 field2 field3 field4 field5 3/26/2015 1:42:00
field1 field2 field3 field4 field5 3/27/2015 1:42:00

Aucun commentaire:

Enregistrer un commentaire