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

Case review: e-commerce user growth hacking methodology

User operations in e-commerce involve many points...

How to apply for WeChat Small Store? The application process is as follows

WeChat officially announced on August 20 that WeC...

How to create an effective brand slogan?

Why do brands and marketing companies pay so much...

Sharing useful information! Promotion strategy of application market

1. Overall Logic There is only one logic in runni...

OPPO and vivo outperform Huawei: a victory of pragmatism

In 2016, while the overall structure of the globa...

Google Glass can be used to steal passwords with 90% accuracy

The latest research results from the University o...

By 2023, how far has the genomics revolution progressed?

Original title: 70th anniversary of the discovery...

5 hidden details in WatchKit

There are only a few months left before the offic...

​Xiaomi's Lei Jun plays with chip giants in the palm of his hand?

Yesterday, a piece of news about Xiaomi and Media...