Created
April 19, 2016 19:03
-
-
Save sahilseth/677389090e4e1197aecdc58900b3ec08 to your computer and use it in GitHub Desktop.
du by file type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -printf "%f %s\n" | | |
awk '{ | |
PARTSCOUNT=split( $1, FILEPARTS, "." ); | |
EXTENSION=PARTSCOUNT == 1 ? "NULL" : FILEPARTS[PARTSCOUNT]; | |
FILETYPE_MAP[EXTENSION]+=$2 | |
} | |
END { | |
for( FILETYPE in FILETYPE_MAP ) { | |
print FILETYPE_MAP[FILETYPE], FILETYPE_MAP[FILETYPE]/10^6, FILETYPE; | |
} | |
}' | sort -n > du_type.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment