bash programming question

Konstantin Riabitsev yellowdog-general@lists.terrasoftsolutions.com
Mon Jan 26 09:17:01 2004


This works:

for FILE in `find /etc -type f`; do 
    if [ -r "$FILE" ]; then 
        FILEN=`basename $FILE` 
        ALLIN=`cat $FILE | wc -l`
        NOCOMM=`sed "/^#/d; /^$/d" $FILE | wc -l`
        printf "%s:\t%d\t%d\n" $FILEN $ALLIN $NOCOMM
    fi
done

Much simpler than perl. :)

Cheers,
-- 
Konstantin Riabitsev <icon@linux.duke.edu>
Linux@DUKE