Using awk to calcluate average file size

Hi I want to use awk to find out:

a) The total number of files in a directory
b) The total filesize
c) The average filesize

I know I need to ls-l | awk ....something ....

but its the something Im stuck on!! Can anyone help?
stummjAsked:
Who is Participating?
 
ozoCommented:
ls -l | awk '$6{b+=$5;a+=1}END{print a,b,b/a}'
0
 
stummjAuthor Commented:
Thanks Ozo
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.