#!/bin/bash sum=0; for i in `find ./ -type f \( -iregex .*\.h -or -iregex .*\.cpp \) -exec du -b '{}' \; | cut -f 1`; do sum=$(( $sum + $i )); done; lines=`find ./ -type f \( -iregex .*\.h -or -iregex .*\.cpp \) -exec cat '{}' \; | wc -l` echo $sum bytes echo $(( $sum/1024 )) kbytes echo $(( $sum/1024/1024 )) mbytes echo $lines lines