The UNIX and Linux Forums  


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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 05-23-2007
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,245
Quote:
Originally Posted by ghostdog74
Code:
awk '!/^#/ && !/^$/{c++}END{print c}' "file"
to extend that somewhat(untested):


Code:
awk '!/^[ \t]*(#|$)/ {c++; ct++} /#/ && c { printf "%s\n\n\n%s", c, $0; c=0} END { print ct}' file


Last edited by reborg; 05-23-2007 at 09:17 PM..