The log file has the following date format and I was hoping that grep could extract the last 24hrs. I managed to get todays data via grep "22/10/2021" test.txt
, but want to setup crontab to execute a script each day that simply selects the last 24hrs from the logfile and places it in the test.txt file.
[22/10/2021, 3:12:57 pm] [Kitchen ] Received MQTT: zigbee2mqtt/0x84
[22/10/2021, 3:13:35 pm] [Son17] Received MQTT: zigbee2mqtt/0x00
[22/10/2021, 3:13:42 pm] [Entrance ] Received MQTT: zigbee2mqtt/0x8