LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices

Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Old

Listing the average file size for all subfolders (+listing subfolders without ls or find)

Posted 08-03-2014 at 08:11 PM by the dsc (linux-related notes)
Updated 08-03-2014 at 09:04 PM by the dsc

A tiny "Frankenstein monster" one liner, adding a little bit from several sources/blogs/blog comments:

lsf | while read d ; do find ./"$d" -iname "*.*" -type f -printf "%k\n" | gawk '{sum += $1; n++;} END {print sum/n;}' |sed "s|$| -- $d|" ; done | sort -n

Where the first "command", "lsf" is actually a custom function:

Code:
lsf ()
{
for f in * ; do [ -d "$f" ] &&
...
Member
Posted in Uncategorized
Views 145 Comments 0 the dsc is offline

  



All times are GMT -5. The time now is 11:16 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration