I was testing an awk one-liner and hit one that doesn&#39;t work. <br><pre>awk &#39;{ s = 0; for (i = 1; i &lt;= NF; i++) s = s+$i; print s }&#39;<br><br>should return the number of word/field per line. I haven&#39;t tinkered with the FS setting. the file I&#39;m testing on is an ipsolorum I generated days ago. It&#39;s at the bottom of this email.<br>
<br>When I test the values I should get with:<br>grep -o &quot; &quot; test| grep -c &quot; &quot;<br>where test has the ipsolorum text I get 626 which, without actually counting seems OK if not a bit high.<br><br>But the awk returns:<br>
0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>12<br>0<br>0<br>0<br><br><br>Correct # of lines but totally crap number of words.<br><br><br><br><br></pre><br clear="all"><br>-- <br>-- <br>James P. Kinney III<br>
Actively in pursuit of Life, Liberty and Happiness         <br><br>