By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,799 Members | 1,379 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,799 IT Pros & Developers. It's quick & easy.

count lines wihtout comments

P: 8
How can i copunt no of lines in a ksh script without counting the commented lines..
is there any single line command
Mar 25 '08 #1
Share this Question
Share on Google+
5 Replies

micmast
100+
P: 144
reverse a grep then count

grep -v \# | wc -l
Mar 25 '08 #2

P: 8
reverse a grep then count

grep -v \# | wc -l

Thanks a lot.
Really
Mar 26 '08 #3

radoulov
P: 34
Or:

Expand|Select|Wrap|Line Numbers
  1. grep -c '^[^#]' file
Mar 28 '08 #4

P: 8
Thanks a Lot for the alternative solutio
Apr 4 '08 #5

Expert 100+
P: 511
reverse a grep then count

grep -v \# | wc -l
it really depends on where "#" is.
Apr 6 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.