I am struggling to get the logs from a file for a given timeframe. I have gone through other posts but everywhere the date/time has been hardcoded, I don't want it to be hardcoded and would like to fetch it programatically.
This is what I have been trying.
This works,
awk -F, -v b='2016-08-10 00:40:06' -v e='date +"%F %T"' '{ if ($1 >= b && $1 <= e) print}' filename
Whereas this doesn't work,
awk -F, -v b='date --date="10 minutes ago" +"%F %T"' -v e='date +"%F %T"' '{ if ($1 >= b && $1 <= e) print}' filename
Not sure why the first Date parameter is not getting calculated on the fly?