The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Removing Blank Lines dhanamurthy Shell Programming and Scripting 3 05-08-2008 01:52 AM
Eliminate blank lines... shashi_kiran_v UNIX for Dummies Questions & Answers 4 09-06-2005 12:39 AM
Remove blank lines osymad UNIX for Dummies Questions & Answers 4 08-27-2005 06:41 AM
delete blank lines or lines with spaces only vascobrito UNIX for Dummies Questions & Answers 3 01-13-2004 07:36 AM
Blank Lines - End of file saabir Shell Programming and Scripting 4 07-15-2003 11:55 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-23-2007
kthatch kthatch is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 28
How to count lines - ignoring blank lines and commented lines

What is the command to count lines in a files, but ignore blank lines and commented lines?

I have a file with 4 sections in it, and I want each section to be counted, not including the blank lines and comments... and then totalled at the end.

Here is an example of what I would like my output to look like:

##comment##
line1
line2
line3
line4
line5
line6

6 lines

##comment##
line7
line8
line9
line10
line11
line12
line13
line14
line15
line16
line17

11 lines

##comment##
line18
line19
line20
line21
line22

5 lines

##comment##
line23
line24
line25
line26
line27
line28
line29
line30
line31
line32
line33
line34
line35

13 lines

35 total lines

Thank you in advance, for your help!
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 05:09 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0