#!/bin/bash # find compression ratio of source files # pipe this through 'sort -n' to find files with a lot of redundancy ZIP=gzip #ZIP=bzip2 for FILE in `find -name '*.[ch]' | grep -v _darcs`; do SIZE=`ls -l $FILE | awk '{ print $5 }'` ZSIZE=`$ZIP $FILE -c | wc -c` SCORE=`dc -e "$SIZE 100 * $ZSIZE / n"` echo $SCORE $FILE done