xargs count file lines

含空行注释

1
2
find . -name "*.java"|xargs wc -l|grep "total"|awk '{print $1}'  
find . -name "*.java"|xargs cat|wc -l #Output:37634

去空行

1
find . -name "*.java"|xargs cat|grep -v ^$|wc -l    #Output:36335

去注释

1
find . -name "*.java"|xargs cat|grep -v -e ^$ -e ^\s*\/\/.*$|wc -l    #Output:36064

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×