?
Solved

Using awk to calcluate average file size

Posted on 2007-07-31
2
Medium Priority
?
1,729 Views
Last Modified: 2013-12-26
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?
0
Comment
Question by:stummj
2 Comments
 
LVL 85

Accepted Solution

by:
ozo earned 2000 total points
ID: 19601524
ls -l | awk '$6{b+=$5;a+=1}END{print a,b,b/a}'
0
 

Author Comment

by:stummj
ID: 19601613
Thanks Ozo
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question