Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 03-08-2009
Member
 
Join Date: Jul 2009
Posts: 11
bash code to count lines

hello guys... I'm new to linux and so to bash programming. I want to write a simple bash code to count lines, what all i need? Please help a noob...
Reply With Quote
  #2  
Old 03-08-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: bash code to count lines

Try this and replace whichever character you feel appropriate :
Code:
grep -v '^[ ]*$' file | wc -l
Reply With Quote
  #3  
Old 03-08-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: bash code to count lines

Have a look at this official website of 'count line of code' : http://cloc.sourceforge.net/. This may help you or may be try these codes :
Code:
grep -c '[^[:space:]]' file
Code:
find *.h -print0 | xargs -0 wc -l
Reply With Quote
  #4  
Old 03-08-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: bash code to count lines

Why don't you try this out :

Code:
#!/bin/bash

check out goes here
cd dir
grep -r "*;*" * | wc -l
Do post back and tell me if it works...
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "bash code to count lines"
Thread Thread Starter Forum Replies Last Post
Mac OSX error message? INVALID VOLUME FILE COUNT and INVALID VOLUME DIRECTORY COUNT? Aaghaz Operating Systems 6 25-02-2011 10:40 AM
Error in bash file Dwin123 Operating Systems 5 25-02-2010 10:40 PM
Need C program code to count numbers of negative & positive numbers Sarfaraj Khan Software Development 5 16-01-2010 02:00 PM
Bash script if then else help Unix'EM Software Development 3 18-08-2009 06:34 PM
BASH Programming Functions Jackie Software Development 1 17-03-2009 12:48 PM


All times are GMT +5.5. The time now is 12:18 PM.