Search code examples
bashsedfindwc

Use find, wc, and sed to count lines


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.


Solution

  • You may also get the nice formatting from wc with :

    wc `find -name '*.m'`