AWK: is there some flag to ignore comments?
        Posted  
        
            by HH
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by HH
        
        
        
        Published on 2010-04-21T22:33:22Z
        Indexed on 
            2010/04/21
            22:43 UTC
        
        
        Read the original article
        Hit count: 275
        
Comment rows are counted in the NR.
- Is there some flag to ignore comments?
 - How can you limit the range in AWK, not like piping 
| sed -e '1d', to ignore comment rows? 
Example
$ awk '{sum+=$3} END {avg=sum/NR} END {print avg}' coriolis_data
0.885491                          // WRONG divided by 11, should be by 10
$ cat coriolis_data 
#d-err-t-err-d2-err
.105    0.005   0.9766  0.0001  0.595   0.005
.095    0.005   0.9963  0.0001  0.595   0.005
.115    0.005   0.9687  0.0001  0.595   0.005
.105    0.005   0.9693  0.0001  0.595   0.005
.095    0.005   0.9798  0.0001  0.595   0.005
.105    0.005   0.9798  0.0001  0.595   0.005
.095    0.005   0.9711  0.0001  0.595   0.005
.110    0.005   0.9640  0.0001  0.595   0.005
.105    0.005   0.9704  0.0001  0.595   0.005
.090    0.005   0.9644  0.0001  0.595   0.005
        © Stack Overflow or respective owner