CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Counting number of lines in multi-file large code

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   December 12, 2004, 14:45
Default Counting number of lines in multi-file large code
  #1
Abhijit Tilak
Guest
 
Posts: n/a
Hello all,

Is anybody aware of any free utility for calculating number of lines in a multi-file (40-50 files language C, platform RedHat 9.0) code. Ideally I am looking for something that may work like this:

<utility_name> input >> *.c output << < total number of lines in *.c>>

I checked out programmers_heaven.com. There are some utilities like this for MS Windows, but they operate on single file. I thought about using cat or grep, but it does'nt seem like a smart idea.

Here's how this question came about: I recently had an interview with a FEA s/w development company. The interviewer asked me how many lines is your code ? I told the interviewer that I never kept track of that!

Thanks Abhijit

  Reply With Quote

Old   December 12, 2004, 16:59
Default Re: Counting number of lines in multi-file large c
  #2
Hrvoje Jasak
Guest
 
Posts: n/a
You're using Unix, right? The command you want is wc -l So:

cat *.c | wc -l

for all .c files in a directory; or more complex:

find . -type f -name "*.[ch]pp" -exec cat {} \; | wc -l

to find all files .hpp and .cpp files in the currect directory tree and count them. For more info, read man pages
  Reply With Quote

Old   December 12, 2004, 17:10
Default Re: Counting number of lines in multi-file large c
  #3
Abhijit Tilak
Guest
 
Posts: n/a
Hello Dr. Jasak,

wow! you nailed it. Thanks for your answer.

Abhijit
  Reply With Quote

Old   December 12, 2004, 18:33
Default Re: Counting number of lines in multi-file large c
  #4
zxaar
Guest
 
Posts: n/a
and if u are in windows .... and want to count lines in VS project .. isaw one program on codeproject.com that does that for you.
  Reply With Quote

Reply

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2.0.x on Mac OSX niklas OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 74 March 28, 2012 16:46
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 09:01
BlockMeshmergePatchPairs hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise mbeaudoin OpenFOAM Installation 20 June 17, 2008 06:43
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00


All times are GMT -4. The time now is 13:14.