<div dir="ltr">Hi Mike,<div><br></div><div>I am not sure how to introduce a field separator to readData(). I tried adding '|' between header and data fields but seems readData is complaining that file header does not match type and it expected space separated items:</div>
<div><br></div><div><div>File header does not match type. Expected 4 whitespace separated items. Got 5 instead.</div><div><span class="" style="white-space:pre"> </span>swiftscript:readData, quadui-multi.swift, line 27</div>
</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 13, 2014 at 11:05 AM, Wilde, Michael J. <span dir="ltr"><<a href="mailto:wilde@mcs.anl.gov" target="_blank">wilde@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma"><div class="im">Did you try different field separators? I think in the past Ive used spaces. Perhaps the readData() code is not sufficiently white-space-aware yet?
<div><br>
</div>
</div><div><div class="im">- Mike<br>
<div><br>
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div><br>
</div>
<div>--</div>
<div>Michael Wilde</div>
<div>Mathematics and Computer Science Computation Institute</div>
<div>Argonne National Laboratory The University of Chicago</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div><div style="font-size:16px;font-family:Times New Roman"><div class="im">
<hr>
<div style="direction:ltr"><font face="Tahoma" color="#000000"><b>From:</b> <a href="mailto:swift-user-bounces@ci.uchicago.edu" target="_blank">swift-user-bounces@ci.uchicago.edu</a> [<a href="mailto:swift-user-bounces@ci.uchicago.edu" target="_blank">swift-user-bounces@ci.uchicago.edu</a>] on behalf of Ketan Maheshwari [<a href="mailto:ketan@mcs.anl.gov" target="_blank">ketan@mcs.anl.gov</a>]<br>
<b>Sent:</b> Monday, January 13, 2014 11:01 AM<br>
<b>To:</b> Swift User<br>
<b>Subject:</b> [Swift-user] readData is treating line as a single field<br>
</font><br>
</div>
<div></div>
</div><div><div class="h5"><div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>I am trying to use readData() function in Swift to read fields into a Swift structure but seems it is reading the whole line as a single field. </div>
<div><br>
</div>
<div>Here is my text file for the data:</div>
<div><br>
</div>
<div>
<div>$ cat data.txt</div>
<div>Survey_data Strategy_data Field_data quadui_outdir</div>
<div>/home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Survey_data_import_fixed.zip /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Seasonal_strategy_fixed.zip /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Field_Overlay_fixed.zip
/home/kcm92/outdir_1</div>
<div>/home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Survey_data_import_fixed.zip /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Seasonal_strategy_fixed.zip /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Field_Overlay_fixed.zip
/home/kcm92/outdir_2</div>
</div>
<div><br>
</div>
<div>I have 4 fields and 2 rows.</div>
<div><br>
</div>
<div>Here is the structure definition:</div>
<div><br>
</div>
<div>
<div>type Data{</div>
<div> string Survey_data;</div>
<div> string Field_data;</div>
<div> string Strategy_data;</div>
<div> string quadui_outdir;</div>
<div>}</div>
</div>
<div><br>
</div>
<div>Here is the Swift loop that I am using to process this data:</div>
<div><br>
</div>
<div>
<div>Data d[] = readData(@arg("data"));</div>
<div>/* run quadui */</div>
<div>foreach ditem in d{</div>
<div>tracef("Survey data is: %s", ditem.Survey_data);<br>
</div>
<div>}</div>
</div>
<div><br>
</div>
<div>In the output, I get the whole first row of the file instead of the expected first field. </div>
<div><br>
</div>
<div>Any clues?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Ketan</div>
</div>
</div>
</div></div></div>
</div>
</div>
</div>
</blockquote></div><br></div>