I was testing an awk one-liner and hit one that doesn't work. <br><pre>awk '{ s = 0; for (i = 1; i <= NF; i++) s = s+$i; print s }'<br><br>should return the number of word/field per line. I haven't tinkered with the FS setting. the file I'm testing on is an ipsolorum I generated days ago. It's at the bottom of this email.<br>
<br>When I test the values I should get with:<br>grep -o " " test| grep -c " "<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>