LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-05-2002, 01:10 PM   #1
Tekime
Member
 
Registered: Feb 2002
Location: East Coast USA
Distribution: Slackware
Posts: 53

Rep: Reputation: 15
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!
 
Old 09-05-2002, 01:21 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
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
 
Old 09-06-2002, 02:04 AM   #3
Tekime
Member
 
Registered: Feb 2002
Location: East Coast USA
Distribution: Slackware
Posts: 53

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 08:19 PM
Command Line Help: Remove a List of Files lukasbradley Linux - Newbie 2 08-17-2005 05:21 AM
php command line scripts naflan Programming 5 11-09-2004 09:02 AM
Command line tool to print length of mp3 files? J_Szucs Linux - Software 3 05-04-2004 06:01 AM
How may I list only the directories in command line? geraldomanaus Linux - Newbie 5 03-20-2003 01:40 PM


All times are GMT -5. The time now is 06:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration