Sample Header Ad - 728x90

Pick out a date from a command response

1 vote
2 answers
103 views
I have a command response that looks something like that: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX | XXX | Thu Oct 18 03:32:00 UTC 2018 XXX | XXX | Thu Oct 18 03:32:00 UTC 2018 There are a lot of tab spaces between each set of characters and pipe. The aim is to pick out the date from the response and then compare it with the current time, find the difference and make sure it's not more than 300 seconds. This is my first time making a shell script and I am not sure how this could work. I have tried using grep to get the entire line. Is there a way to neglect the spaces in between the characters? How do I convert that format of a date to the regular date format?
Asked by Aman Deep Middha (13 rep)
Oct 18, 2018, 11:55 PM
Last activity: Aug 4, 2020, 06:25 AM