Calculate LOC by shell script

  • Navigating to you project folder, run(python project)
find . -name "*.py" |xargs grep -v "^$"|wc -l
  • If it is a Objective-C project, the the script should look like this:
find . -name "*.m" -or -name "*.h" |xargs grep -v "^$"|wc -l
  • If it is a Swift project, the the script should look like this:
find . -name "*.swift" |xargs grep -v "^$"|wc -l

grep -v “^$”: ignore blank lines

About Tang

A mobile developer, work in Stockholm, Sweden
This entry was posted in Mac, Mobile. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s