LS with du divided by ls wc-l sub directory average


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting LS with du divided by ls wc-l sub directory average
# 1  
Old 04-10-2008
LS with du divided by ls wc-l sub directory average

Hi.

I am trying to write a script that will create a list of directories with their total disk usage (including subdirectories) divided by the number of sub directories.

so i run an ls like this ls -d */images/*/, and that would give me my list. Then i want to get the du of every directory returned in that list, but divided by the number of subdirectories in it. Thereby giving me a subdirectory average of every directory in the output.

Thank you for any help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help with average calculation.

i have a file with 2 columns. i want to calculate the average of column 1 based on the values of column 2. here's how the file looks like. i want to calculate the sums of numbers corresponding to 1 and then calculate the average. same for numbers corresponding to zero. any help with a code would... (1 Reply)
Discussion started by: onerokeyz
1 Replies

2. Shell Programming and Scripting

Bash to calculate average of all files in directory and output by part of filename

I am trying to use awk to calculate the average of all lines in $2 for every file in a directory. The below bash seems to do that, but I cannot figure out how to capture the string before the _ as the output file name and have it be tab-delimeted. Thank you :). Filenames in... (3 Replies)
Discussion started by: cmccabe
3 Replies

3. Shell Programming and Scripting

Average score

awk '{if(len==0){last=$4;total=$6;len=1;getline}if($4!=last){printf("%s\t%f\n", last, total/len);last=$4;total=$6;len=1}else{total+=$6;len+=1}}END{printf("%s\t%f\n", last, total/len)}' exon.txt > output.txt In the attached file I am just trying to group all the same names in column $4 and then... (2 Replies)
Discussion started by: cmccabe
2 Replies

4. Shell Programming and Scripting

Find the average and the different

Hi , Every day I'll get a file, in that I have to match today's file(20130619) third column to previous files (20130618,20130617), that is 124 present in previous files or not. If it matches then I have take the average values of 5th column of 124 from yesterdays and day before yesterdays file,... (5 Replies)
Discussion started by: Shenbaga.d
5 Replies

5. Shell Programming and Scripting

sum divided by count

Dear friends, I'm stuck with the task below, I would be thankful for all your replies. INPUT : Date Price Volume 20110601 73052811.61 2845833 20110602 61489062.96 9909230 20110603 72790724.65 1108927 20110606 48299507.20 7435881 20110607 ... (5 Replies)
Discussion started by: hernand
5 Replies

6. Shell Programming and Scripting

divided by 0 problem

Hi! i have a new shell script that will compute for a value... a = b/(b+c) c = d/(d+e) print b" "a" "d" "c but there will be an instance that either b+c or d+e will be "0".... if b+c or d+e is "0" it will print "#NA#... pls help me... thanks! (10 Replies)
Discussion started by: kingpeejay
10 Replies

7. Programming

calculate average

I have a file which is 2 3 4 5 6 6 so i am writing program in C to calculate mean.. #include<stdio.h> #include<string.h> #include <math.h> double CALL mean(int n , double x) main (int argc, char **argv) { char Buf,SEQ; int i; double result = 0; FILE *fp; (3 Replies)
Discussion started by: cdfd123
3 Replies

8. Shell Programming and Scripting

count average

Hi Friends, Can any one help me with count average of student marks in this file (i can not change structure of the input file): input file: 1:John Smith:2 3 4 5 2:Mark Anderson:3 2 3:Susan Waterman:2 4 2 (numbers of marks are different) output: Name:John Smith ID#: 1 Avg. mark:... (6 Replies)
Discussion started by: mleplawy
6 Replies

9. Shell Programming and Scripting

how to write divided function

hi iam facing problem for divided (%) arthemtic function in for condition. tell me reply and all the arthemtic function in one scripting . (2 Replies)
Discussion started by: naveeng.81
2 Replies

10. UNIX for Dummies Questions & Answers

average value

If I have a file like this, could anyone please guide me how to find the average value in each metrix. The file has got about 130,000 metrixs. Grid-ref= 142, 235 178 182 203 240 273 295 289 293 283 262 201 176 167 187 187 246 260 282 299 312 293 276 230 191 169 ... (2 Replies)
Discussion started by: su_in99
2 Replies
Login or Register to Ask a Question
DH_USRLOCAL(1)							     Debhelper							    DH_USRLOCAL(1)

NAME
dh_usrlocal - migrate usr/local directories to maintainer scripts SYNOPSIS
dh_usrlocal [debhelperoptions] [-n] DESCRIPTION
dh_usrlocal is a debhelper program that can be used for building packages that will provide a subdirectory in /usr/local when installed. It finds subdirectories of usr/local in the package build directory, and removes them, replacing them with maintainer script snippets (unless -n is used) to create the directories at install time, and remove them when the package is removed, in a manner compliant with Debian policy. These snippets are inserted into the maintainer scripts by dh_installdeb. See dh_installdeb(1) for an explanation of debhelper maintainer script snippets. If the directories found in the build tree have unusual owners, groups, or permissions, then those values will be preserved in the directories made by the postinst script. However, as a special exception, if a directory is owned by root.root, it will be treated as if it is owned by root.staff and is mode 2775. This is useful, since that is the group and mode policy recommends for directories in /usr/local. OPTIONS
-n, --noscripts Do not modify postinst/prerm scripts. NOTES
Note that this command is not idempotent. dh_prep(1) should be called between invocations of this command. Otherwise, it may cause multiple instances of the same text to be added to maintainer scripts. CONFORMS TO
Debian policy, version 2.2 SEE ALSO
debhelper(7) This program is a part of debhelper. AUTHOR
Andrew Stribblehill <ads@debian.org> 9.20120909 2011-09-12 DH_USRLOCAL(1)