<div dir="ltr"><div><div>Stephen and Bill,<br></div>Both good ideas. Thanks. I had thought of both, but wondered if there was something even more fundamental/simple. In the end I went with Stephen's suggestion.<br><br></div>Jeff<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 3, 2015 at 4:33 PM, Stephen McMillan <span dir="ltr"><<a href="mailto:smcmillan@planalytics.com" target="_blank">smcmillan@planalytics.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Jeff,<div><br></div><div>Bill R's suggestion may be the simplest and quickest but, if you need to keep the commas in there, you could write a function that uses a combination of sublin and substr (a character at a time) to location the positions of the commas, then use that information and substr to extract the data between them. For example, let's say p1=10 and p2=18 (positions of successive commas), then you could do something like this:</div><div><br></div><div>pcpn=substr(lineofdata,'p1+1','lof') where "lineofdata" is your read-in record and lof=p2-p1-1 (length of field)<br></div><div><br></div><div>then repeat until there are no commas left in the line. Repeat for each successive record.</div><div><br></div><div>Stephen Mc</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 3, 2015 at 4:44 PM, Bill Reilly <span dir="ltr"><<a href="mailto:bill_reilly@compuserve.com" target="_blank">bill_reilly@compuserve.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Jeff:<br>
<br>
You can try replacing all the commas with spaces first (using a text<br>
editor or command line function) and then you can use the subwrd()<br>
command like normal.<br>
<br>
Bill<br>
<br>
--<br>
<br>
Bill Reilly<br>
<a href="tel:%28%2B34%29%20686-110-748" value="+34686110748" target="_blank">(+34) 686-110-748</a><br>
<br>
<a href="mailto:bill@passageweather.com" target="_blank">bill@passageweather.com</a><br>
<a href="http://www.passageweather.com" rel="noreferrer" target="_blank">www.passageweather.com</a><br>
<br>
<a href="mailto:bill@brwebworks.com" target="_blank">bill@brwebworks.com</a><br>
<a href="http://www.brwebworks.com" rel="noreferrer" target="_blank">www.brwebworks.com</a><br>
<div><div><br>
On 9/3/2015 9:17 PM, Jeff Duda wrote:<br>
> Is there a simple function in Grads to read text data from a csv file?<br>
> The intrinsic function read() offers an advantage for files with<br>
> spaces, making the subwrd() command particularly useful. However, when<br>
> there are no spaces, obtaining specific columns, especially when the<br>
> number of digits used to express the data is not the same between<br>
> different records, becomes quite tedious. There must be something that<br>
> already exists that's simpler than what I'm currently doing.<br>
><br>
> Jeff Duda<br>
><br>
> --<br>
> Jeff Duda<br>
> Graduate research assistant<br>
> University of Oklahoma School of Meteorology<br>
> Center for Analysis and Prediction of Storms<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Jeff Duda<br>Graduate research assistant<br>University of Oklahoma School of Meteorology<br>Center for Analysis and Prediction of Storms<br></div>
</div>