occasionally, users creates a file containing data using different file (for backtracking purpose). i want the script to automatically detect the latest file. and if that file contains the word LIST then that is the file i am looking for.
you are right oombera... but i have already used:
find . -name -type f -exec grep -l "LIST" {} \; | xargs ls -lt | head -n 1
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