That looks cool David. Thanks a lot!<br><br>Ketan<br><br><div class="gmail_quote">On Tue, Jun 21, 2011 at 6:18 PM, David Kelly <span dir="ltr"><<a href="mailto:davidkelly999@gmail.com">davidkelly999@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hey Ketan,<br><br>I ran into something like this recently. I used an external mapper and did something like this:<br><br>
type file;<br>file myfiles[][] <ext; exec="<a href="http://mapper.pl" target="_blank">mapper.pl</a>">;<br>
<br>foreach farray,i in myfiles {<br> foreach myfile,j in farray {<br> tracef("myfiles[%i][%i] is %s\n", i, j, @filename(myfiles[i][j]));<br> }<br>}<br><br>The mapper just has to know something about how you want your data organized. Here's a simple mapper that should work for your example:<br>
<br>#!/usr/bin/perl -w <br>use strict;<br><br>my @alphabet = ("a" .. "z");<br><br>foreach my $count(0..scalar(@alphabet)-1) {<br> my @files = `find . -name \'$alphabet[$count]*\'`;<br> foreach my $filecount(0..scalar(@files)-1) {<br>
print "[$count][$filecount] $files[$filecount]";<br> }<br>}<br><br>So basically this just uses the find command to print something like this:<br><br>[0][0] a_00<br>[0][1] a_01<br>[0][2] a_02<br>[1][0] b_00<br>
<br>I think something like that should do the trick.<br><br>David<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Tue, Jun 21, 2011 at 4:59 PM, Ketan Maheshwari <span dir="ltr"><<a href="mailto:ketancmaheshwari@gmail.com" target="_blank">ketancmaheshwari@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div class="h5">Hello,<br><br>I am trying to get a 2 dim array to map to a directory with a given pattern as follows:<br>
<br>The directory contains files with names as follows:<br><br>a_00<br>a_01<br>.<br>.<br>a_99<br>b_00<br>b_01<br>.<br>
.<br>.<br>z_99<br><br><br>The mapped variable amap[i][j] should be mapped in such a way that i should map to the prefix and j should map to the suffix part of the file.<br><br>For example: amap[2][10] should return the file c_10.<br>
<br>In addition the said directory is an output directory and does not exist yet.<br><br>A one dimensional array mapping exists for this which is as follows:<br><br>file dat_files[] < simple_mapper;<br> padding = 3,<br>
location = "output",<br> prefix = @strcat( str_root, "_" ),<br> suffix = ".dat" >;<br><br>I looked into external mappers but could not figure out how exactly to go for it.<br>
<br>Any clues?<br><br><br><br>Regards,<br><font color="#888888">Ketan<br><br>
</font><br></div></div>_______________________________________________<br>
Swift-user mailing list<br>
<a href="mailto:Swift-user@ci.uchicago.edu" target="_blank">Swift-user@ci.uchicago.edu</a><br>
<a href="http://mail.ci.uchicago.edu/mailman/listinfo/swift-user" target="_blank">http://mail.ci.uchicago.edu/mailman/listinfo/swift-user</a><br></blockquote></div><br>
</blockquote></div><br>