Quick Question: counting columns?

Hi everyone

I have a quick question... I have an ascii file that looks like the one below, and I wanted to find a way to make a listing of how many columns there is in each row, similar to the example below.

Anyone has any ideas of how I can do this?

Thanks!!

6 Sep 2008 -158.535 33.6617
3 Sep 2006 -159.525
25 Jul 2008 -147.8617 33.7017
17 2009 -167.39 33.7417
14 Aug 2006 -159.24 33.76
18 Aug -167.4133 33.7617
5 Sep 2004 -149.995 33.8167

List of columns per line:

5
4
5
4
5
4
5

AWK's NF variable shows this.

awk '{print NF}' file

You can use a shell solution if you like:

while read LINE; do
  set -- $LINE
  echo $#
done < file

Awesome! Thanks Scott! Works like a charm