Use find, wc, and sed to count lines

Berlin Brown picture Berlin Brown · Sep 11, 2009 · Viewed 42.9k times · Source

I was trying to use sed to count all the lines based on a particular extension.

find -name '*.m' -exec wc -l {} \; | sed ...

I was trying to do the following, how would I include sed in this particular line to get the totals.

Answer

Emmanuel BERNAT picture Emmanuel BERNAT · Sep 11, 2009

You may also get the nice formatting from wc with :

wc `find -name '*.m'`