Hi All
I am writing a script which will select the latest logs (which are generated every night via a script) among old one and new. Script generates set of 3 logs each time it runs. Example :
log-WedJun082011_bkt1.log
log-WedJun082011_bkt2.log
log-WedJun082011_bkt3.log
I have successfully written script to select latest logs(all 3 bkt) using "tail -1" cmd. Now, I am not getting idea to select latest log if only one log is generated (due to script failure) Like :
log-ThuJun092011_bkt1.log
log-WedJun082011_bkt1.log
log-WedJun082011_bkt2.log
log-WedJun082011_bkt3.log
As my script is using "tail -1" it will include latest of each bkt and will give wrong result. I just want to parse the latest log and display error message.
Can someone help here ? Appreciate your help.
Thanks
Ratnesh