Hi All,
I need something where I could take the date from FILE1
and in this case the date is Thu Sep 10 13:48:42 EDT 2015
and I need it to match the closest PREVIOUS date in the log file FILE2
this means in this specific case it would be Thu Sep 10 2015 13:35:28
.
I only need the closest date and nothing else as I am grepping and sedding with the value gotten, btw the date can be days before in some rare cases.
FILE1
77777;HP-BLADE;4;661;0;1;Thu Sep 10 2015 13:48:42;0;0;Matthew;send email to Carlos;
FILE2
Thu Sep 10 2015 03:01:18;.1.3.6.1.4.1.x.x.3.34;Critical;Status Events;87.200.x.x;77777;Automation Device;ERROR DETECTED;HP-BLADE
Thu Sep 10 2015 10:29:48;.1.3.6.1.4.1.x.x.3.34;Critical;Status Events;87.200.x.x;77777;Automation Device;ERROR DETECTED;HP-BLADE
Thu Sep 10 2015 13:35:28;.1.3.6.1.4.1.x.x.3.34;Critical;Status Events;87.200.x.x;77777;Automation Device;ERROR DETECTED;HP-BLADE
Thu Sep 10 2015 16:34:49;.1.3.6.1.4.1.x.x.3.34;Critical;Status Events;87.200.x.x;77777;Automation Device;ERROR DETECTED;HP-BLADE
So the preferred output I am looking for is only the date example:
Thu Sep 10 2015 13:35:28
Thanks again all for all your help, this has been driving me nuts!! and I'm sure there is a simple solution. I would prefer a 1 liner and if possible in awk
and sed
if possible if not I don't mind calling a third party script.