One line of command to count the total number of lines of iOS project code

One line of command to count the total number of lines of iOS project code

Sometimes we want to count the total number of lines of code in our project to gain a sense of accomplishment or for other purposes. Here are some easy ways to count the number of lines of code. It is very simple. The method is as follows:

[[210580]]

1. Open the terminal;

2. Use the cd command to reach our project file. Note that if we want to avoid counting the amount of code in the referenced third-party library, we need to go further into the code file we wrote ourselves, which is usually a file with the same name as the project file;

3. Count the number of code lines:

If you want to list the number of lines in each file, enter the command:

  1. find.- name "*.m" - or - name "*.h" - or - name "*.xib" - or - name "*.c" |xargswc-l

If you want to list the total number of code lines directly, enter the command:

  1. find.- name "*.m" - or - name "*.h" - or - name "*.xib" - or - name "*.c" |xargsgrep-v "^$" |wc-l

In this way, you can get the quantity directly, and it is very fast. Isn’t it convenient?

This counting process will remove blank lines, but comments will be counted.

<<:  [Special Topic] The 11th issue of the Aiti Tribe Technical Clinic: How to check 30 million data in seconds

>>:  Some experiences and summaries of hybrid APP cross-platform development in 2017-2018

Recommend

Search bidding planning budget strategy!

In actual search bidding, you will often encounte...

Why does the more you drink Coke, the thirstier you get? Here comes the truth

Many people like to drink a bottle of Coke when t...

Talking about products and operations: What are user expectations?

Well, I’ve been a bad product manager . Therefore...

Would you like to be "dumped" to Mars?

In the past two years, the whole society has beco...

How can you do Android development if you don’t even understand Context?

Activity mActivity =new Activity() As an Android ...

Shanghai, why does we need Lingang?

Looking down on Shanghai from the sky, people can...

〔2021 Summer〕Senior 3 Biology Target A+ Lu Weiwei

〔2021 Summer〕High School Biology Target A+ Lu Wei...

Precise traffic generation techniques for Toutiao today!

one Speaking of Toutiao, I believe everyone is fa...

Foxconn says it won't run away, but suspicions persist

The topic of manufacturing has attracted particul...