I found a command that worked almost completley
<c>z=`ls -la "$f" | awk '{ printf("%-15s\t%10d\n", $9, $5)}'`</c>
This command works perfect. The onlyput I need is $5 though. When I remove $9 it does not work. Is there something I am missing?
Chris
I hope I wasn't being rude, I was just letting you know I could not get the Typeset command to work with those switches. I do see the command for typeset and have been trying to play with it.
Chris
OK now I am totally confused, the code you gave me worked perfect on the command line. It was Right aligned.
<CODE>ls -la | awk '{s[NR]=$5;if(l<length($5))l=length($5)}END{for(i=1;i in s;i++)printf"%"l"s\n",s[i]}'</CODE>
However when I tried to add it into my script and added this
<CODE>
for...
Well, the output of the ls -la command for size would be the larger sizes would be to the left and on the right the smaller sizes line up. Such as
123456
123
567
33
123456
That would be correct. WHen you use ls -la | awk '{print $5}'
The output looks more like
123456
22
234
235...
I am using z=`ls -la "$f" | awk '{print $5} to pipe the filenames from one variable into another variable for later output.
However the filenames print left to right, I really need them to print right to left the way they do in the ls -la command
chris
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.