Home » Infrastructure » Unix » tail command and time stamp
tail command and time stamp [message #313137] |
Thu, 10 April 2008 17:28  |
shree_z
Messages: 75 Registered: February 2008
|
Member |
|
|
Hi all i am using the following code to get the files from a directory
ls -lrt A*.txt | tail -1 | awk '{print $9}' | read fname
Is the format correct?.
ALso the files in the directory are now being named with time on them. So my problem is for eg:
I have a file with "A.20080410.0700.txt"(file name appended with date 10th april) and "A.20080408.0700.txt" (file name appended with date 8th april)
if "A.20080408.0700.txt" was inserted into the directory after A.20080410.0700.txt, the program takes "A.20080408.0700.txt" first for processing irrespective of the date and time appended to the filename.(where as I expect the program to process "A.20080410.0700.txt" first)
I need the program in such a way that it pulls the file in accordance with the date and time appended to the file name rather than processing the file in the order in which they were generated in the directory.
How can I get this done?
Thanks in advance.
|
|
|
|
|
|
Goto Forum:
Current Time: Thu Apr 17 02:12:25 CDT 2025
|