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
mktrashcan(1)						      General Commands Manual						     mktrashcan(1)

NAME
mktrashcan, rmtrashcan, shtrashcan - Attaches, detaches, or shows a trashcan directory SYNOPSIS
/usr/sbin/mktrashcan trashcan directory... /usr/sbin/rmtrashcan directory... /usr/sbin/shtrashcan directory... OPERANDS
Specifies the directory that contains files that were deleted from attached directories. Whenever you delete a file in the specified directory, the file system automatically moves the file to the trashcan directory. Specifies the directory that you attach to a trashcan directory. DESCRIPTION
The trashcan utilities (mktrashcan and rmtrashcan) enable you to attach or detach an existing directory, which you specify as a trashcan directory, to any number of directories within the same fileset. A trashcan directory stores the files that are deleted with the unlink system call. For instance, you can use the mktrashcan utility to attach a trashcan directory called /usr/trashcan to one or more directories; thereafter, when you delete a file from one of the attached directories, the file system moves the file to the /usr/trashcan directory. Note that when more than one directory shares attachment to a trashcan directory, files with the same file name can overwrite each other in the trashcan directory. If you mistakenly delete a file, use the mv command to return the file from the /usr/trashcan directory to its original directory. When you enter shtrashcan at the system prompt, the system shows the trashcan directory, if one exists, for the directory you specified. It is important that trashcan directories have correct access permissions. If the permissions are too restrictive, then it may be impossi- ble to remove files from the directories that are attached to the trashcan directory. In general, all users and groups that expect to use the trashcan directory need write permission to the directory. If unexpected "permission denied" errors occur when deleting files that are in a directory attached to a trashcan directory, use the chmod command to change the permissions on the trashcan directory. RESTRICTIONS
The directory and trashcan directories must be in the same fileset; however, you can attach the trashcan directory to any directory within the fileset. EXAMPLES
The following example creates and attaches a trashcan directory, /usr/trashcan, to two directories, /usr/ray and /usr/projects/sql/test, which are in the same fileset. The chmod command adds write permission for all users and groups on the new trashcan directory. % mkdir /usr/trashcan % chmod a+w /usr/trashcan % mktrashcan /usr/trashcan /usr/ray /usr/projects/sql/test To attach the trashcan directory, /usr/trashcan, to all subdirectories in the /usr directory, enter: % mktrashcan /usr/trashcan /usr/* New subdirectories that you add beneath the /usr directory are not attached to the trashcan directory until you attach them. Also, the mktrashcan utility distinguishes between directories and files, attaching only directories to the trashcan directory. Note that an attached directory produces an EDUPLICATE_DIRS (-1165) error when /usr/trashcan is itself in the directory path you attach to (as in the previous example). You can ignore this error message. SEE ALSO
advfs(4), mkfset(8), showfsets(8) mktrashcan(1)