Operating System - HP-UX
1838598 Members
4384 Online
110128 Solutions
New Discussion

how to awk the ll command .. ??

 
SOLVED
Go to solution
someone_4
Honored Contributor

how to awk the ll command .. ??

is there a way to awk the ll command
and get only the file size, date, time, and filename? Then take this info and append it each time it runs to a .txt file ?

Thanks for your help..
Richard

3 REPLIES 3
Rodney Hills
Honored Contributor
Solution

Re: how to awk the ll command .. ??

Try

ll | awk '{print $5,$6,$7,$8,$9}' >>afile.txt
There be dragons...
Kevin Wright
Honored Contributor

Re: how to awk the ll command .. ??

awk '{print $X}'
the fields start at $0, from left to right
A. Clay Stephenson
Acclaimed Contributor

Re: how to awk the ll command .. ??

Hi Richard,
There are any number of ways to do this, but here's one:

LOGFILE=myfile.txt
ll | awk '{print $5, $6, $7, $8, $9}' >> $LOGFILE

You might want to modify it so that you read
the directory as an argument

something like
while [ $# -ge 1 ]
do
DIR=$1
shift
ll ${DIR} | awk -- the rest as above
done

Clay
If it ain't broke, I can fix that.