LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 12: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, 12:21 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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, 01: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



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 07:19 PM
Command Line Help: Remove a List of Files lukasbradley Linux - Newbie 2 08-17-2005 04:21 AM
php command line scripts naflan Programming 5 11-09-2004 08:02 AM
Command line tool to print length of mp3 files? J_Szucs Linux - Software 3 05-04-2004 05:01 AM
How may I list only the directories in command line? geraldomanaus Linux - Newbie 5 03-20-2003 12:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:30 AM.

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
Open Source Consulting | Domain Registration