One way to do it using find (the first "$" is your shell prompt): $ find /path/to/sources/ -iname '*.c' \ | xargs -n 1 wc -l \ | cut -d' ' -f1 \ | (SUM=0; while read NUM; do SUM=$(($SUM+$NUM)); done; echo $SUM) Replace the /path/to/sources directory and '*.c' extension as you need. You can also put the whole thing on one line if you'd like (just remove the backslashes between the lines if you do); but I like to keep the piped commands on separate lines for clarity. Granted, it's probably not the most efficient way, but it works... :] That will give you all file names in that directory (recursive) as well as the lines count in each of them, such as: -- Peter Gordon (codergeek42) GnuPG Public Key ID: 0xFFC19479 / Fingerprint: DD68 A414 56BD 6368 D957 9666 4268 CB7A FFC1 9479 My Blog: http://thecodergeek.com/blog/
Attachment:
signature.asc
Description: This is a digitally signed message part