Skip to content

Instantly share code, notes, and snippets.

@shigemk2

shigemk2/sizeav.sh

Created Mar 31, 2013
Embed
What would you like to do?
ディレクトリを除く、ディレクトリ内のファイルサイズの平均を取得する
#!/bin/sh
# This script shows file-size average
ls -lF | grep -v / | awk '
{ sum += $5 } END { ave = 0; ave = sum / (NR-1) / 1024; if(ave < 1024) { printf("%3.2f%s\n", ave, "KB"); } else { ave /= 1024 ; printf("%3.2f%s\n", ave, "MB"); } }
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment