Change the display format for ls -l command in AIX

 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support Change the display format for ls -l command in AIX
# 1  
Old 06-08-2011
Change the display format for ls -l command in AIX

Hi,

I am using AIX 5.3. In my server if I list the file , I got the below result in below format.

*********************************************
Code:
-rw-rw--w-   1 letapp1  staff             0 Jun  8 02:53 CC00030710.cntrl

*********************************************

But now I am seeing the one extra space between the "permission tab" and 'number of links" tab.

*********************************************
Code:
-rw-rw--w-    1 letapp1  staff             0 Jun  8 02:53 CC00030710.cntrl

*********************************************

Note:One extra space between "-rw-rw--w- " and "1".

Can anyone please let me know if we can able to modify the ls -l display format?

Thanks in advance,
Puni

Last edited by pludi; 06-08-2011 at 09:06 AM..
# 2  
Old 06-08-2011
Code:
ls -l | sed 's/ /  /'

# 3  
Old 06-08-2011
Not sure wether it will change something or not, but could you try to add a backslash before your ls and see if you still get different output or not :
On Your AIX 5.3
Code:
\ls -l

On your other machine
Code:
\ls -l

Are the output still different ?
# 4  
Old 06-09-2011
Has there been any patch upgrade on your OS?
Because the output what you are receiving is the standard output across all AIX 5.3
# 5  
Old 06-09-2011
Hi Vidyadhar,

Yes, Batch upgrade went in our server. And after the upgrade only 'ls -l' command display format got changed. Many of our jobs are using the cut command with 'ls -l' command.

For example in our job we have the below command to get the size of the file.

***************************************************
Code:
ls -l test_cntl_file | cut -c30-43
-rw-rw-r--   1 letapp1  staff            28 Jun  4 16:00 test_cntl_file

***************************************************
For this we got the result "28".

But now since we got the one extra space between "-rw-rw-r--" and "1", we are getting the result for the above command as "f28".

To change this I need to identify all the jobs and needs to put a change. This will be a huge manual activity.

That why I am looking if I can able to remove the one extra space in 'ls -l' command result by modifying any server setup or something like that.
Thanks,
Punitha.S

Last edited by pludi; 06-09-2011 at 07:27 AM..
# 6  
Old 06-09-2011
This is poor code, if the size is in the 5th column, you should use

Code:
ls -l test_cntl_file | awk '{print $5}'

(this code will not be sensitive to the number of space)


instead of
Code:
ls -l test_cntl_file | cut -c30-43

which will be sensitive to the number of space.
# 7  
Old 06-09-2011
Yes, I agreed. But now if we cant modify the 'ls -l' display format, I need to modify all my scripts Smilie... Is there any way that we can change the dispaly format?

Why I am asking is in AIX with the same version itself, I saw in ls -l comand date field dispaly there is two different results in two different servers.

For example
Code:
-rw-rw-r--   1 letapp1  staff            60 Jun  9 02:00 passed_date.dat
-rw-rw-r--   1 letapp1  staff            60 Jun 09 02:00 passed_date.dat

So I hope there is some way we could achieve this. Please advice

Thanks,
Puni

Last edited by Scott; 06-13-2011 at 06:49 AM.. Reason: Code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to change the format of an Excel from exponential to text through UNIX command?

How to change the format of an excel from exponential to text through UNIX command We have a pipe delimited file in which one particular A column is a combination of number+text and while converting into excel using tr command it is generating a exponential data for the A column. Kindly... (2 Replies)
Discussion started by: AbiramiRaja
2 Replies

2. UNIX for Dummies Questions & Answers

Date format change in AIX

Hi I have a date format in a variable as Apr 7 03:35:59 EDT 2016. how do i change it to 04/07/2016 03:35:59 EDT format (5 Replies)
Discussion started by: sushma123
5 Replies

3. Solaris

Solaris 10 Sparc. How to change Vendor info of SAN disks reported in "format" command?

Greetings! After block level migration using an external appliance, the luns are getting reported as DGC-RAID5 and these luns are infact from the new storage. I have a query on changing the device Vendor info from DGC-RAID5 to HP3par in the format o/p only. AVAILABLE DISK SELECTIONS: ... (3 Replies)
Discussion started by: n_Bhaskar
3 Replies

4. Shell Programming and Scripting

Display date in mm/dd/yy format in sed command

Hi All, Following is my issue. $MAIL_DOC = test.txt test.txt contains the following text . This process was executed in the %INSTANCE% instance on %RUNDATE%. I am trying to execute the following script var=`echo $ORACLE_SID | tr ` NOW=$(date +"%D") sed -e... (3 Replies)
Discussion started by: megha2525
3 Replies

5. AIX

Change AIX display resolution ?

Hello, Running X on AIX local display - want to change resolution. On Linux for example I used xrandr. ? thanks Vilius (1 Reply)
Discussion started by: vilius
1 Replies

6. Shell Programming and Scripting

How to change date format in 'last' command?

hi.. i am new to here. can anybody tell me how can we change the date format in the 'last' command. EX- on running last command i am getting -- rruat pts/12 172.18.40.101 Tue May 3 12:59 still logged in rruat pts/10 blr2-3f-239.asco Tue May 3 12:59 - 13:09 ... (2 Replies)
Discussion started by: thearpit
2 Replies

7. Shell Programming and Scripting

Format of SED command to change a date

I have a website. I have a directory within it with over a hundred .html files. I need to change a date within every file. I don't have an easy way to find/replace. I need to change 10/31 to 11/30 on every single page at once. I tried the command below but it didn't work. Obviously I don't know... (3 Replies)
Discussion started by: ijustsawmars
3 Replies

8. AIX

Single command to change the attributes of all luns presented to an AIX host

Hi, I would like to know if there is a command similar to scsimgr in HP-UX that can help me change the algorithm and reserve_policy attributes of all luns presented to an AIX host. Otherwise I would have to use, chdev -l hdiskX -a algorithm=round_robin reserve_policy=no_reserve in a... (1 Reply)
Discussion started by: kanna_geekworkz
1 Replies

9. Shell Programming and Scripting

ls command format display

Hi I have 3 files $ ls -l -rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 SANITY_TEST -rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 Success 123333 -rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 Success 123333 (1) I need to see this "SANITY_TEST" "Success 123333" "Success... (6 Replies)
Discussion started by: mnmonu
6 Replies

10. AIX

Analogue of Format Command in AIX for IBM

I need to install AIX 5.3 on an RS/6000 Server. When i boot from an AIX 5.3 CD i get an option to upgrade to 5.3 from 5.2(existing OS). Is there a way by which i can force AIX to perform a new install with creating new partitions. I am looking for the analogue of 'Format' command in AIX that... (2 Replies)
Discussion started by: bestoption
2 Replies
Login or Register to Ask a Question