Advertisement

calculate the total line numbers of files in directory

Started by March 06, 2008 09:58 AM
3 comments, last by baumep 16 years, 10 months ago
I want to calulate the total line numebers of the files(*.h *.cpp) in certain directory(include its subdirecories). How to I write the command? cat ./tmp/*.h | wc -l
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
maybe wc -l `find -iname "*.h"`
Advertisement
Quote: Original post by Trenki
maybe wc -l `find -iname "*.h"`


The command you written does not work.

cat a/*.h a/*.cpp | wc -l
but cannot include the subdirectories.
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
sloccount?

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

Try:

find . -name "*.h" -o -name "*.cpp" | xargs wc -l
baumep

This topic is closed to new replies.

Advertisement