Check

echo "2012-12-26--14.8224 2012-12-27--14.2898 2012-12-28--14.9180 2012-12-29--13.3637 2012-12-30--13.7091"

the set of numbers i provided above is separated by spaces. how do i count how many sets there are?

i tried:

echo "2012-12-26--14.8224 2012-12-27--14.2898 2012-12-28--14.9180 2012-12-29--13.3637 2012-12-30--13.7091" | wc -w

---------- Post updated at 10:57 AM ---------- Previous update was at 10:56 AM ----------

actually never mind, i think i may have found the solution:

echo ""2012-12-26--14.8224 2012-12-27--14.2898 2012-12-28--14.9180 2012-12-29--13.3637 2012-12-30--13.7091"" | wc -w

notice the double quotes.

Your double-quotes do -- literally -- nothing at all, remove them.

Is 5 not the right answer?

yes it is. and i got it from using the double quotes.

---------- Post updated at 11:10 AM ---------- Previous update was at 11:09 AM ----------

if the double quotes are meaningless, please provide a better suggestion.

What do you get? I get:

$ echo "2012-12-26--14.8224 2012-12-27--14.2898 2012-12-28--14.9180 2012-12-29--13.3637   2012-12-30--13.7091" | wc -w
       5
$ echo 2012-12-26--14.8224 2012-12-27--14.2898 2012-12-28--14.9180 2012-12-29--13.3637   2012-12-30--13.7091 | wc -w
       5

I agree with Corona688 that using double double quotes is meaningless..

I suggested removing them. Note that your program works the same either way.

The real question is, what was happening in the first place to make a wrong answer when your quotes make no difference? Either your data or your program must have been unexpectedly different in some way.