We are using AIX operating system.
Issue with the first two files which we need to get month and year but it is not coming.
When I use the ls -lrt command, I am having the problem.
ls -lrt command output
-rw-r----- 1 abc_dev devdatagrp 1234 17 Dec 08:30
-rw-r----- 1 abc_dev devdatagrp 87073 17 Dec 08:30
-rw-r----- 1 abc_dev devdatagrp 57077 17 Jan 08:33
-rw-r----- 1 abc_dev devdatagrp 122 28 Feb 16:15
-rw-r----- 1 abc_dev devdatagrp 35677 14 Mar 16:16
Expected output: ls- lrt
-rw-r----- 1 abc_dev devdatagrp 1234 17 Dec 2010 08:30
-rw-r----- 1 abc_dev devdatagrp 87073 17 Dec 2010 08:30
-rw-r----- 1 abc_dev devdatagrp 57077 17 Jan 08:33
-rw-r----- 1 abc_dev devdatagrp 122 28 Feb 16:15
-rw-r----- 1 abc_dev devdatagrp 35677 14 Mar 16:16
Do we need to ask UNIX team for settings need to change. Any help greatly appreciated.
Do i need to ask UNIX admin to set any options in the operating system level?
Based on the forums, we can�t use every time to change the option.
If I have last year(And also before last year files) files, that should come with year.
if I am not getting year then when I extract date from the file received date, then it is coming as this year instead of last year.
By the way, depending on what you are trying to achieve, maybe extracting the date from an ls command is not an accurate choice (maybe it should be based on the content of the file instead ?)
The requirement is once the file received, i have to get the received timestamp based on the ls -lrt command.
I may get the older files to process. If i get older files to re process then I am getting not proper time stamp.
-rw-r----- 1 abc_dev devdatagrp 1234 17 Dec 2010 08:30 file_name1.txt
-rw-r----- 1 abc_dev devdatagrp 87073 17 Dec 2010 08:30 file_name2.txt
-rw-r----- 1 abc_dev devdatagrp 57077 17 Jan 08:33 file_name3.txt
-rw-r----- 1 abc_dev devdatagrp 122 28 Feb 16:15 file_name4.txt
-rw-r----- 1 abc_dev devdatagrp 35677 14 Mar 16:16 file_name5.txt
when I get received time for the first file (17122011083000) but i should get in this way (17122010083000)
The issue with the year. It is treating as this year time stamp even though it is last year file.
This need to be set OS level to set some options. So that we won�t get it. I have searched all the way information in the forums. Did not see related information.
Using istat i will get i node number but i need to extract the received timestamp information from the file.
What command are you running to get the received time that you listed (17122011083000)? As previously mentioned the ls command will only lsit the year on the file if it's older than 6 months. I realize that the istat commands gives you inode number info but the inode is directly tied to the file and according to the man page it also gives you the date of the last file modification. This will give you the year info on a file less than 6 months old.