<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 29, 2013 at 11:06 PM, Mark Lee <span dir="ltr"><<a href="mailto:mark.lee.phd@gmail.com" target="_blank">mark.lee.phd@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Although it might be easier to just log data to a temporary file, I think I will try the ${a-${i}} method for arrays with wikish. Can you send me example code that will parse a line like the following, and store x and y values in the arrays ${x-${i}} and ${y-${i}}?</div>
<div>(:location x=111 y=222:)</div><div><br></div><div>I have been experimenting with the form</div><div><br></div><div><div>{(wikish source {$FullName}#test)}</div><div><br></div><div>(:if false:)</div>
<div>[[#test]]</div><div>for page in Plants.*</div><div>do</div><div> if grep -q "(:location" ${page}</div><div> then</div><div> set -s dataline = "`grep "x=" ${page}`"</div><div>
echo "${dataline}"</div><div>.......... more code goes here</div><div> fi</div><div>done</div><div>[[#Test]]</div><div>(:ifend:)</div><div><br></div><div>I'm not sure this is the headed in the right direction. Thanks again for your guidance.</div>
</div></blockquote></div><br></div><div class="gmail_extra">It seems like I'm missing something obvious to avoid the triple-pass (although at least I'm only passing over the temporary page), but in any event it works.<br>
<br>You can find the example at <a href="http://pmwiki.qdk.org/pmwiki.php?n=Test.LocCode">http://pmwiki.qdk.org/pmwiki.php?n=Test.LocCode</a>, as before. Source is below my sig.<br><br></div><div class="gmail_extra">-Peter<br>
</div><div class="gmail_extra"><br>{(wikish source {$FullName}#test)}<br><br>(:if false:)<br>[[#test]]<br>grep '\(:location.*x=.*y=' Test.Loc? | sed -e 's/^/||/' -e 's/:\(:/||/' -e 's/ x=/||/' -e 's/ y=/||/' -e 's/:\).*$/||/' >Tmp.X<br>
<br>echo "!!Tmp.X"<br>cat Tmp.X<br><br>echo "!!page"<br>set i = 1<br>cat Tmp.X | cut -d'||' -f2 | while read foo<br>do<br>#echo "DEBUG: foo=${foo}"<br> set -s page_${i} = ${foo}<br>
set i ++<br>done<br><br>echo "!!4"<br>set i = 1<br>cat Tmp.X | cut -d'||' -f4 | while read foo<br>do<br>#echo "DEBUG: foo=${foo}"<br> set -s x_${i} = ${foo}<br> set i ++<br>done<br><br>
echo "!!5"<br>
set i = 1<br>cat Tmp.X | cut -d'||' -f5 | while read foo<br>do<br>#echo "DEBUG: foo=${foo}"<br> set -s y_${i} = ${foo}<br> set i ++<br>done<br><br>for j in 1 2 3<br>do<br> echo "* page=${page_${j}}, x=${x_${j}}, y=${y_${j}}"<br>
done<br><br>[[#endtest]]<br>(:if:)</div></div>