[comp.unix.questions] Half of a ls -l ? INFO-UNIX Digest V12#102

karl@forest.gsfc.nasa.gov (Karl Anderson) (05/14/91)

robby@nuchat.sccsi.com (Robert Oliver Jr.) writes:

>  Has anybody out there ever printed out the size,date and name of a file
>without the permitions and owners just the size,date & name.  I would like 
>to know how you did it!  

Do you have the 'cut' command?  Here's an alias I have defined in my .cshrc 
on my Suns:

alias sdir      'ls -lta \!* | cut -c33- | more'

The "-c33-" option to cut says "print everything from column 33 on."

Karl A. Anderson		| Internet: karl@forest.gsfc.nasa.gov
NASA/GSFC code 923 (STX)	| voice: (301) 286-3815
Greenbelt, MD 20771		| #include "std_disclaimer"

GEBORSA%PLKRCY11@searn.sunet.se ( Mariusz Borsa) (05/15/91)

I think that there is another (simpler) solution, which follows
ls -l  awk '{print $3 $4 $5}'
Yours
Mariusz Borsa

asqe-x-w-ic03@worms-emh1.army.mil (Udo Walter, SYS ADM, CDOIM) (05/15/91)

robby@nuchat.sccsi.com (Robert Oliver Jr.) writes:

>   Has anybody out there ever printed out the size, date and name of a file
>without the permissions and owners just the size, date & name. I would like
>to know how you did it!

Try this one. It gives tells you also whether it's a file or a directory.
Put it in a scriptfile and make it executable.

ls -al $1 | nawk '{if (match($1,"d")) 
                    printf("<DIR> %7d %3s %2s %5s %s\n",$5,$6,$7,$8,$9)
                   else
                    printf("      %7d %3s %2s %5s %s\n",$5,$6,$7,$8,$9)}'| more

Udo Walter