Last Updated: February 25, 2016
·
939
· alexdenisov

Find your fat modules

find /path/to/src -name "*.m" | awk ' { print "\""$0"\"" } ' | xargs wc -l | sort

Change "*.m" with your language extension: rb, java, cpp, etc.

5 Responses
Add your response

You forgot -n flag in sort

Also for Git projects you can use:

git ls-files '*.m' | xargs wc -lm | sort -n
over 1 year ago ·

@hauleth, it works for me without -n. OS X 10.8

over 1 year ago ·

For a Rails project in Ubuntu:

find app/models/ -name "*.rb" | awk ' { print "\""$0"\"" } ' | xargs wc -l | sort -n
over 1 year ago ·

Can someone help understand how these piped commands work? What does each command do.

over 1 year ago ·

@vohof: find look for all files that ends with .m, then awk wraps each line (found file) with " (quotes), count lines, and sort by it.

over 1 year ago ·