Print file count owned by a given user
Print file count owned by a given user How to print the number of files owned by every user in a given directory? So far I am printing user name and disk size. However I want to report out the output of " find $dirname -user <user_name>| wc -l " and print that as a third field in the below printf find $dirname -user <user_name>| wc -l set dirname = "a/b/c" find $dirname -printf "%u %sn" 2 Answers 2 I have a feeling you want to do something like this : find $dirname -printf "%u %sn" | awk '{s[$1]+=$2;c[$1]++}END{for(u in s) print u,s[u],c[u]} This will print a list of users with total accumulated file-size and the total amount of files. Exactly what I was trying to get at! Did a lot of circus and foreach loops with find <dir_name> -user <user_name | wc -l followed by saving the contents into an array. Ev...
