How To Wiki
No edit summary
(Updated via Administrative Bot.)
Line 10: Line 10:
 
</pre>
 
</pre>
   
You can put this command in a [[bash script]] or create and [[alias]]
+
You can put this command in a [[bash script]] or create and [[alias]]<div id="wikia-credits"><br /><br /><small>From [http://howto.wikia.com HowTo Wiki], a [http://www.wikia.com Wikia] wiki.</small></div>
  +
  +
  +
  +
[[Category:Howto]]

Revision as of 02:01, 20 July 2008

You can use find and awk to counting the total number of lines in multiple files

Solution

Using the usual GNU tools, you can write the following script (replace "*.java" with your language file type):

find . -name "*.java" -exec wc -l '{}' \; | awk '{ sum += $1 } END { print sum }'

You can put this command in a bash script or create and alias



From HowTo Wiki, a Wikia wiki.