How To Wiki

How to count the total number of lines in multiple files using a bash script

1,794pages on
this wiki

Method 1 Edit

awk 'END {print NR}' *.java

Method 2 Edit

wc -l *.php

For windows Command line:

for %G in (*.sql) do find /c /v "_+_" %G

For linux Command Line:

wc -l *.sh

Method 3 Edit

cat *.java | wc -l

Method 4 Edit

Using find to generate a list of files, useful when files are in sub directories.

wc -l `find -name '*.java'` 

Around Wikia's network

Random Wiki