Search
 
 

Display results as :
 


Rechercher Advanced Search

Top posting users this month

GeoMap

How to calculate the number of lines of all files under a directory?

View previous topic View next topic Go down

How to calculate the number of lines of all files under a directory?

Post  halala on Thu Jan 15, 2015 12:19 pm

For exmaple, you can use to calculate all the javascript , C, C++, HTML,and java codes under a directory.
Code:
find -name "*.js" -o -name "*.c" -o -name "*.class" -o -name "*.html" -o -name "*.cpp" -o -name "*.h" |xargs cat | wc -l

It utilized the expression feature of the 'find' command,
! for NOT
-o for OR
and you can use "\(" and "\)" as well.
avatar
halala

帖子数 : 99
金币(Coin) : 2161
注册日期 : 2012-08-17

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum