View Single Post
  #6 (permalink)  
Old 03-05-04, 04:57
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
Quote:
Originally posted by aigles
Code:
awk 'NF>0 {count++} END { print count}' input_line
The above would count the number of non-blank lines. To count the number of blank lines, subtract from the record count.
Code:
awk 'NF>0 {count++} END { print NR-count}' yourFile
Another way would be to use grep -c.
Code:
grep -c "^[ \t]*$" yourFile
Damian
Reply With Quote