Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!news.cs.indiana.edu!ux1.cso.uiuc.edu!phil From: phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) Newsgroups: comp.unix.questions Subject: Re: Half of a ls -l ? Message-ID: <1991May12.232213.9435@ux1.cso.uiuc.edu> Date: 12 May 91 23:22:13 GMT References: <1991May12.085633.10066@nuchat.sccsi.com> Organization: University of Illinois at Urbana Lines: 36 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! Assuming you want time with the date, you can pipe "ls -l" through this or some approximation of it to match your ls's output format: ----CUT-HERE--------CUT-HERE--------CUT-HERE--------CUT-HERE--------CUT-HERE---- #!/usr/local/bin/awk -f { if( NF>7 ) { z=substr(" ",length($4)) $4; z=z substr(" ",length($5)) $5; z=z substr(" ",length($6)) $6; z=z substr(" ",length($7)) $7; z=z " " $8; print z; }; }; ----CUT-HERE--------CUT-HERE--------CUT-HERE--------CUT-HERE--------CUT-HERE---- If you don't want the time, leave out the appropriate field. If you new awk is somewhere else, change the first line. Gawk may work, too, but I didn't try it. Watch out for some versions of ls that, when faced with a very high link count, will jam the link count number and the privileges together as one single field. To avoid that you might have to extract the files based on a combination of column number and whitespace, rather than whitespace alone. -- /***************************************************************************\ / Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu | Guns don't aim guns at \ \ Lietuva laisva -- Brivu Latviju -- Eesti vabaks | people; CRIMINALS do!! / \***************************************************************************/