Extract unique files

 
In a incoming folder i have list of files like below,i want to pick the unique files to process the job. if same file  contain more than one then it should pick latest date modified file to process.
 

drwxrwsrwx    2 n308799  infagrp         256 May 20 17:42 Final_Working
drwxrwsrwx    2 n308799  infagrp         256 May 20 17:42 scripts_working
drwxrwsrwx    2 n308799  infagrp         256 May 20 17:42 Scripts_bkp
drwxrwsrwx    2 n308799  infagrp         256 May 22 17:42 Final_Working
output should be as below:
drwxrwsrwx    2 n308799  infagrp         256 May 22 17:42 Final_Working
drwxrwsrwx    2 n308799  infagrp         256 May 20 17:42 scripts_working
drwxrwsrwx    2 n308799  infagrp         256 May 20 17:42 Scripts_bkp

Assuming the lines are in chronological order within the file and there are no spaces in the file names, try

awk '{A[$NF]=$0} END{for(i in A) print A}' file
1 Like