justyy
justyy

Reputation: 6041

How can i sum up the number of lines for all source code in BASH?

I want to find out the total number of lines of code for a given directory (include sub-directory), for example, search for all *.php files and sum up each one using wc -l

How can I combine commands (using pipe) and achieve this on BASH shell? Simpler the better.

Upvotes: 2

Views: 94

Answers (1)

sjrd
sjrd

Reputation: 22085

How about

$ find . -name "*.php" | xargs wc

?

Upvotes: 3

Related Questions