list command issue


 
Thread Tools Search this Thread
Operating Systems AIX list command issue
# 1  
Old 03-14-2011
list command issue

Hi,

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.

Code:
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

Code:
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.

Thanks
# 2  
Old 03-14-2011
The date format change to display year only when files get older than 6 months (or something like this)
# 3  
Old 03-14-2011
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.

Any help greatly appreciated.

Thanks -One Suri

Last edited by pludi; 03-14-2011 at 09:48 AM..
# 4  
Old 03-14-2011
Code:
man stat

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 ?)
# 5  
Old 03-14-2011
Or better (on AIX):

Code:
man istat

# 6  
Old 03-14-2011
@Scott,

You're true, i totally forgot this thread was regarding an AIX plateform ... ooops Smilie
# 7  
Old 03-15-2011
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.
Code:
-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.

Any help greatly appreciated.

Thanks

Last edited by zxmaus; 03-15-2011 at 09:52 AM.. Reason: corrected code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command issue

I am on Linux LXLE. I been trying to change directories and opens folders and files. 1. I cd /home file 2. then user (/home/teak/) Then I try to open the Document file, wouldn't it be /home/teak/doument? . It responds not a directory. So how would I open the document file, or not... (3 Replies)
Discussion started by: teak
3 Replies

2. Shell Programming and Scripting

Issue with zenity list on ftp

Hello guys, I am trying to create simple script which will show user GUI and redirect him to folder which he will chose based on his action, the folder is variable which has to be selected by user, the rest of the script updates/copies/removes values in that folder. it is quite simple to... (2 Replies)
Discussion started by: defila
2 Replies

3. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

4. UNIX for Dummies Questions & Answers

rm command issue

Hi, Getting the below error. rm *.txt bash: /usr/bin/rm: Arg list too long I understand the error is because there are lakhs of .txt file. Any fix ? (16 Replies)
Discussion started by: mohtashims
16 Replies

5. Shell Programming and Scripting

Issue with command tr.

Hi, I am using tr command like below: cat file_name | tr -c "" "" > output_file When i run my script from command mode, it is working fine. I scheduled my job in autosys. When the job runs at specified I am getting below Error: tr: when translating with complemented character... (5 Replies)
Discussion started by: Karteek
5 Replies

6. Shell Programming and Scripting

Issue with WC command

I am trying to show out the character count of a file if greater than 500 characters. When I do the -m its show the size of the file and not the characters in the file. Where am I getting confused? Or is -c and -m the same thing? Code is below if ; then echo "Char... (3 Replies)
Discussion started by: tvb2727
3 Replies

7. Shell Programming and Scripting

dd command issue

dd if=/dev/zero of=/var/images/abc.img bs=1M count=0 seek=2097152 dd: truncating at 2199023255552 bytes in output file `/var/images/abc.img': File too large The dd commad fails here saying its truncating if I try same command with less value for seek it works dd if=/dev/zero... (3 Replies)
Discussion started by: amol28kulkarni
3 Replies

8. UNIX for Dummies Questions & Answers

WC command Issue

Hello Guys... I am a newbie to Unix. I am having a requirement, Like in a file, I want to count the number of characters, I used wc -c and wc -m, But both are giving the byte count instead of character count. Please help me guys... Its very very urgent. Really appreciate ur help.. ... (5 Replies)
Discussion started by: mraghunandanan
5 Replies

9. UNIX for Dummies Questions & Answers

cp command issue.

All, I have files in directory,when i try to overwrite those files it gave operation not permitted error. I am using same group user (ina2) while overwritng this file. Sample file : -rw-rw-r-- 1 ina1 indev 316 Jun 06 13:44 ONCTEST.dat Error: cp: /proj/out/ONCTEST.dat: Operation... (4 Replies)
Discussion started by: sai_nj
4 Replies

10. Shell Programming and Scripting

An issue with find command.

Hi all, I have a shell script(ksh) which has the code as follows. ------------------ cd $mydir for i in `find ./ -type f -mtime +$k` do echo $i done ----------------------- And in $mydir , i have some files which have space in theie names like "Case att15". The out put of the... (6 Replies)
Discussion started by: rajugp1
6 Replies
Login or Register to Ask a Question