|
|
|
| Web Hosting |
![]() ![]() |
Source Code Line Counter - Know Of Any ? |
Apr 5 2005, 03:22 PM
Post
#1
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 myCENTs:84.36 |
Hi,
Do you guys know of any Source Code Line Counter - that's NOT LIMITED to a single file - but would take a whole directory or choice of files and list the total number of lines in all of them ??? Have searched far and wide but couldn't find one Actually, never mind. I found an excellent one at: http://www.codeproject.com/macro/linecount.asp - it's FREE and best part is it plugs itself into both Visual Studio 6 and VS.NET 2003 - and does a one-click line count of your whole project. Stats are broken up into total line count, remarked lines, blank lines etc. Very very handy. Even the source code is up there. But I'm still looking for one, that'd run independent of any IDE and parse whole directories at a time based on file extensions. If you guys come across any, please post in here. Thanks |
|
|
|
Apr 5 2005, 04:52 PM
Post
#2
|
|
|
Penguin Holmes Group: Members Posts: 225 Joined: 22-March 05 From: Poland Member No.: 3,163 |
Hi...
I saw that you are Regiestered Linux user, so it must be in Linux CODE #!/bin/bash EXTENSIONS=".tex .abc" DIRECTORIES="design flash" if [ -e /tmp/countertemp ]; then echo "delete /tmp/countertemp to continue" exit 1 fi mkdir /tmp/countertemp COUNTERALL="0" COUNTER="1" LINESALL="0" for DIRECTORY in $DIRECTORIES do for EXTENSION in $EXTENSIONS do COUNTERALL=`expr $COUNTERALL + 1` find $DIRECTORY -name *$EXTENSION -fprint /tmp/countertemp/_"$COUNTERALL"_.files done done while [ $COUNTER -le $COUNTERALL ] do FILES="/tmp/countertemp/_"$COUNTER"_.files" LINES=$(wc "$FILES"|awk '{print $1}') LINE_NUMBER="1" while [ $LINE_NUMBER -le $LINES ] do FILENOW=$(tail +$LINE_NUMBER "$FILES"|head -1) LINENOW=$(wc "$FILENOW"|awk '{print $1}') LINESALL=`expr $LINESALL + $LINENOW` LINE_NUMBER=`expr $LINE_NUMBER + 1` done COUNTER=`expr $COUNTER + 1` done echo $LINESALL rm -r /tmp/countertemp You enter directories that contains your files (it would look in sub directories to), and file extensions that you want get counted... the result is number of lines from all those files... is this what you mean or you was talkin about something else? PS.: you can modyfi it of course... - "all right are given to all" |
|
|
|
Apr 5 2005, 05:36 PM
Post
#3
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 myCENTs:84.36 |
Woowoowoow !!! Thanks a tonne buddy
|
|
|
|
Apr 5 2005, 05:43 PM
Post
#4
|
|
|
Penguin Holmes Group: Members Posts: 225 Joined: 22-March 05 From: Poland Member No.: 3,163 |
No problem...
I would sugest to tweak this in two places...: 1) make it use also command line arguments... you won't nead to tweak code every time 2) you probably would like to change way the number of lines if give, just change last echo, to something else, or send stream to file... this would be probably more usesfulll than now... probably you can get it easier, but I just like bash, since it is portable at all Lins |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
21 | WeaponX | 2,411 | 5th January 2009 - 04:44 PM Last post by: yordan |
|||
![]() |
16 | spacewaste | 6,330 | 29th December 2008 - 10:02 PM Last post by: miladinoski |
|||
![]() |
11 | sendto | 6,986 | 26th December 2008 - 12:59 PM Last post by: iG-nwaynge |
|||
![]() |
1 | TavoxPeru | 123 | 18th December 2008 - 10:30 AM Last post by: wutske |
|||
![]() |
0 | tek3D | 235 | 13th December 2008 - 01:22 PM Last post by: tek3D |
|||
![]() |
5 | veerumits | 209 | 27th November 2008 - 07:56 PM Last post by: yordan |
|||
![]() |
36 | master_nero | 5,106 | 24th November 2008 - 09:59 PM Last post by: toby |
|||
![]() |
0 | BuffaloHELP | 312 | 24th November 2008 - 03:10 AM Last post by: BuffaloHELP |
|||
![]() |
18 | x2crazy4shadyx | 2,511 | 16th November 2008 - 11:18 PM Last post by: Guest |
|||
![]() |
4 | khalilov | 294 | 21st October 2008 - 03:44 PM Last post by: yordan |
|||
![]() |
2 | ejasoft | 878 | 23rd September 2008 - 11:30 AM Last post by: magiccode9 |
|||
![]() |
4 | Kyle Perkins | 1,290 | 21st September 2008 - 11:31 AM Last post by: Quatrux |
|||
![]() |
10 | cool | 1,532 | 20th September 2008 - 12:49 AM Last post by: sparkx |
|||
![]() |
14 | TavoxPeru | 2,250 | 15th September 2008 - 01:24 PM Last post by: yordan |
|||
![]() |
3 | xboxrulz | 1,541 | 13th September 2008 - 08:04 PM Last post by: Guest |
|||
|
Lo-Fi Version | Time is now: 10th January 2009 - 04:56 AM |
© 2009 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Apr 5 2005, 03:22 PM





