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
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.
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
Yes, I agreed. But now if we cant modify the 'ls -l' display format, I need to modify all my scripts :wall:... 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
-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
This is an opportunity to improve your code, too. If there's numerous places this is used, you could get rid of a lot of redundancy by having that done by one thing which everything else calls or sources instead of having that routine duplicated in 17 different scripts.
One was missing a perl module ( Stat/lsMode.pm ), but all compiled and the other 2 ran, although one had a strange output for option "-l". The one that ran correctly compared favorably with the native ls, but not exactly as regards spacing.
So if you wanted to modify ls output with a project-specific code in perl, you could.
However, I agree with many of the others, and suggest that you clean up your scripts. Counting on specific locations in a line for a datum is a very fragile technique, as you have found.
Good luck with whatever decision you make ... cheers, drl
Thank you. Surely I need to modify my code. But I am curious to know if there is a way that we can set the 'ls -l' command dispaly format or it never possible in unix?
In this last column, I need to subtract the number 006 ( for which * symbol is showing )
from 0010. i.e., 10 - 6 arithmetic operation. How to subtract the numbers in a column
? Can you please advise ?
017E Not Visible \(M\) 0 00 005
- AVAILABLE 0 00 006 \*
033F Not Visible 0 00 010
0340 Not Visible 0 00 011
0341 Not Visible 0 00 012
0342 Not Visible 0 00 013
0343 Not Visible 0 00 014
0344 Not Visible 0 00 015
0345 Not Visible 0 00 016
0346 Not Visible 0 00 017
0347 Not Visible 0 00 018
0348 Not Visible 0 00 019
0349 Not Visible 0 00 01A
034A Not Visible 0 00 01B