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

The spring breeze blows, the flowers smile, why is your nose so noisy?

Spring is the most beautiful season of the year, ...

Is it good or bad for programmers to encounter such a leader during code review?

Today, when I was browsing the website, I saw a p...

How to efficiently learn and master new technologies

Recently, I have learned and practiced React, whi...

How to sell tens of millions of wine through short videos?

Short video sales have become a common sales meth...

Wedding photography placement guide for the National Day Golden Week!

During the National Day Golden Week, many men and...

Zhang Jian's growth path in key customer sales | Compilation

What kind of course is this? "The Road to Gr...

Dark matter accounts for 85% of the universe, so why can't we find it?

The author or source of this article or its origi...

An article to understand the best route to learn Android

[[155803]] Preface I saw an article saying "...

Lotus changes leadership, Geely's Feng Qingfeng to become CEO

According to Automotive News Europe on June 4, Lo...

Advertising results are always poor? Have you done these 5 things?

When you first came into contact with the Interne...