script question

From: Stephen Spalding (ssaixadm@YAHOO.COM)
Date: Tue Jul 29 2003 - 14:42:24 EDT


Is there a way to display the number of fields in a
string using the awk command? Suppose I have a string
like this:

string="hi there, steve, how are you"

I want to be able to count the number of fields in
this string as delimited by the ','. It looks like I
want to do something like this:

echo $string | awk -F, '{print $NR}'

This should return 3, but it just returns 1. Can
anyone help me out here?

Thanks!

-Stephen Spalding

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:04 EDT