|
|
Question : shell script parsing file name
|
|
I have a directory where the 3 new log files are dropped everday. The older files are not archived. I need to pull out out these files. The files are named in this order:
abc_posDEF_02292008034556.log abc_tranDEF_02292008033020.log abc_balDEF_022920080350126.log
The data time are appended to the filename. The naming convention for the 3 files are the same everyday till DEF_ only thing which changes is the date and time. I need to pull out the 3 files which are dropped latest . I need to do this in a shell script so when I runt the script I need to pull out the files dropped "today" that is on Feb 29. Please advise.
|
Answer : shell script parsing file name
|
|
ls -tr | tail -3
|
|
|
|
|