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.
views:
16answers:
1
Q:
How can I count all of the lines in all of the files in the current directory and child directories?
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
2010-09-22 22:02:38