views:

16

answers:

1

I'm trying to figure out how many lines of code have been written for an app. Code is in the current directory and child directories. I'm using ubuntu.

A: 
find . -type f -name \*.c -exec wc -l {} \;  > /tmp/c_counts
find . -type f -name \*.h -exec wc -l {} \;  > /tmp/h_counts

This will produce the wc output for each file with a particular extension, one extension per /tmp file. You could run these results through a simple awk script to get the grand total, if that's what you need.

Jim Lewis