LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Command to list line length of multiple scripts (http://www.linuxquestions.org/questions/linux-general-1/command-to-list-line-length-of-multiple-scripts-29660/)

Tekime 09-05-2002 12:10 PM

Command to list line length of multiple scripts
 
What command, or rather combination of commands, could be used to count and display the length in lines of all PHP files in a directory, recursively?

Basically I need to look through all directories within my htdocs directory, count the line length of every PHP file in these directories, and spit out the numbers. The ouput from wc is sufficient, but I can't figure out how to run it on every PHP file on my directory tree.

Thanks for any help with this one!

acid_kewpie 09-05-2002 12:21 PM

just use a find to erm.. find the list of files and use that input for the varible in a for loop

for i in `find /htdocs *.php`
do
wc -l $i
done

just add more stuff to make it useful

Tekime 09-06-2002 01:04 AM

Thanks acid_kewpie... I haven't gotten more than a few minutes all day to try this. I had a few issues with the script, it said there was in invalid parameter '-n' to wc but I didn't put one there. *sigh* I just need a few minutes to work with it but thanks for the help :)


All times are GMT -5. The time now is 12:13 AM.