I am trying to grep logs that happened in the last hour, time format is like this: 2020-11-01 18:46:56.036
I tried to run this:
grep "^$(date -d -1 hour +'%Y-%m-%d %H')" postgresql-Mon.log | tail -n 100
but that doesn't work. Also how do I use the tail command without -n? I want to grep from bottom to top but to get all the logs from the last hour not only 100.
Help please :>
I know there are other ways doing it but I need it with grep command