in the below .. i want to pick the latest logfile which is having JPS.PR inside..
that means i want particularly "spgport040408041223.log:@@@@@@@@ 04:13:09 Adding: JPS.PR."
which is latest among these..
is it possible to compare the current time with logfile time ?
Command we tried using to grep ERROR from lastest 1 log files from 5 logs files available in that particular directory is:
grep ERROR 'ls -ltr | tail -1'
but this command is not working.. for me its saying.. cannot open DistributeImageFilesToTarget_10_dataLocations_PhillipinesDataLocations.xml.log
if i give ls -lrt for all the files in that diretory
Try "ls -1tr" in place of "ls -ltr". The parameter "-1" (-one) just displays the filename as distinct from "-l" (-ell) which gives more detail and confuses your script.