Pick out a date from a command response

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












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?



Thank you!









share







New contributor




Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • are date/time are always the same? meaning you have two lines have date/time are these always the same? pelasee clarify?
    – Goro
    54 secs ago














up vote
0
down vote

favorite












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?



Thank you!









share







New contributor




Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • are date/time are always the same? meaning you have two lines have date/time are these always the same? pelasee clarify?
    – Goro
    54 secs ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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?



Thank you!









share







New contributor




Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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?



Thank you!







shell-script shell hp-ux





share







New contributor




Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share







New contributor




Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share



share






New contributor




Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 6 mins ago









Aman Deep Middha

1




1




New contributor




Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Aman Deep Middha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • are date/time are always the same? meaning you have two lines have date/time are these always the same? pelasee clarify?
    – Goro
    54 secs ago
















  • are date/time are always the same? meaning you have two lines have date/time are these always the same? pelasee clarify?
    – Goro
    54 secs ago















are date/time are always the same? meaning you have two lines have date/time are these always the same? pelasee clarify?
– Goro
54 secs ago




are date/time are always the same? meaning you have two lines have date/time are these always the same? pelasee clarify?
– Goro
54 secs ago















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Aman Deep Middha is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476449%2fpick-out-a-date-from-a-command-response%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Aman Deep Middha is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Aman Deep Middha is a new contributor. Be nice, and check out our Code of Conduct.












Aman Deep Middha is a new contributor. Be nice, and check out our Code of Conduct.











Aman Deep Middha is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476449%2fpick-out-a-date-from-a-command-response%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?