Column $3 and $4 in my log file have a date timestamp and I want to use sed
or a similar command to edit the file in place to remove records older than 24 hours.
2015-07-29 04:30:12
2015-07-29 04:30:21
2015-07-29 04:30:21
2015-07-29 04:30:21
2015-07-29 04:31:42
I use something like this successfully to search for records between dates.
LAST24HR=$(date "+%Y-%m-%d %H:%M:%S" -d "-24 hour")
NOW=$(date "+%Y-%m-%d %H:%M:%S")
awk '$3" "$4>=from&&$3" "$4<=to' from="$LAST24HR" to="$NOW"
Is there a way I can remove lines in place from the file in a similar manner?