Wednesday, 28 August 2013

Using find before wc eliminates total

Using find before wc eliminates total

I'm using find to search through all subdirectories and current directory
to find all .py files, and then run wc -l to find number of lines.
However, when I use find with wc, the Total field is left off, unlike when
I run wc by itself. Does anyone know why this is happening?
find . -name \*.py -exec wc -l {} \;
187 ./check.py
43 ./file.py
33 ./mitch.py
...
1014 ./serve.py
41 ./test_scripts/line_graph.py
39 ./welcome.py
But no total, but when I run wc -l *.py in a directory I get a total:
wc -l *.py
187 check.py
43 file.py
94 log_com.py
154 log_results.py
33 mitch.py
1014 serve.py
39 welcome.py
1564 total

No comments:

Post a Comment