[Swift-user] swift syntax question

Yi Zhu yizhu at uchicago.edu
Fri May 29 13:19:27 CDT 2009


Hi,


In order to let swift write output to another directory rather than 
currently running location, we can use  simple_mapper with location 
parameter like
"<simple_mapper; location ="/mnt/s3", prefix="foobar", suffix=".txt">,

but if I want to use regexp_mapper, since there is no 'location' 
parameter available for regexp_mapper, 
(http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.simple_mapper)
how can i sort it out?



For example, In this case, every files with prefix "data" and suffix 
".txt" at location "/mnt/testdata/1024Kdir" will be map to inputfiles[] 
array, and for each running of loop, the  regexp_mapper will modify the 
".txt" to 'swift xxx.swift' command), so how can i specify a output 
location other than the default/current one?







(catfile t) catwords (messagefile f) {
     app {
         cat @filename(f) stdout=@filename(t);
     }
}


messagefile inputfiles[] 
<filesys_mapper;location="/mnt/testdata/1024Kdir",prefix="data" 
,suffix=".txt">;


foreach f in inputfiles {
   catfile c<regexp_mapper;source=@f,match="(.*)txt",transform="\\1out">;
   c = catwords(f);
}


Many Thanks!


-Yi Zhu




More information about the Swift-user mailing list