Writing shell script to extract last 24hrs of a log file: Raspbian on Pi

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


from Recent Questions - Stack Overflow https://ift.tt/3m9N8bR
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)