|
get the latest file by reading the date in the filename.
Hi,
I grep for a pattern in a list of files.
"grep -i -l $pattern *.datx*"
it may give me n number of files.
say for eg, it gives me 2 files.
lock_eicu_20071228_00000000.dat_20071228_05343100
lock_eicu_20080501_00000000.dat_20080501_05343900
out of these 2 files I need to get the latest file according to the date present after the .dat extn. As 20071228 is older than 20080501, i need to get the second file.
so in the above eg, i need to get the filename
lock_eicu_20080501_00000000.dat_20080501_05343900
can u please help.
|