Navigation Home / Tags / Grep

ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

1
Date Submitted Sat. Mar. 8th, 2008 1:41 PM
Revision 1
Helper chorny
Tags find | Grep | Perl
Comments 0 comments
Usage:
found('asdf',@array);

P.S. In perl 5.10 can be written as
use 5.010;
'asdf'~~@array;
7
Date Submitted Fri. Jul. 20th, 2007 11:49 PM
Revision 1
Helper lavaramano
Tags "remove string" | cli | console | gnu/linux | Grep
Comments 1 comments
how to remove a string from a plain text using just grep.
7
Date Submitted Thu. Sep. 14th, 2006 1:45 PM
Revision 1
Helper dohpaz
Tags bash | Code | Comments | Grep | Sed
Comments 1 comments
I found this script online, and decided that I would modify it for my needs. As a developer, I like to know how many actual lines of code I have written--not including any comments.

It outputs in a very simple way:

Including Comments: NNN
Without Comments: NNN

One very practical, and quick, way to determine how many lines of code a project has is to pipe it through a find:


find /usr/share/php -name "*.php" -o -name "*.inc" | xargs count-code


If your code is in files of another type (i.e., .c, .h, .cpp, etc), then simply change the extensions and add more '-o -name "*.ext"' tags. If you have directories that you don't want to be counted, simple throw a "| grep -v [path/to/excluded/directory] |" inbetween the find and the xargs, and they will not be counted.