The current git version passes the testsuite with flying colors. http://git.savannah.gnu.org/cgit/parallel.git/snapshot/parallel-31e86ed9aed7250991e494cbba0d1b806775e01c.tar.gz
It would be great if you could give it a spin, so see if I missed any bugs. Clock with blinking ':': parallel -k echo {1}'{=3 $_=$_%2?":":" "=}'{2}{3} ::: {0..12} ::: {0..5} ::: {0..9} /Ole On Sat, Jul 12, 2014 at 2:52 AM, Ole Tange <o...@tange.dk> wrote: > GNU Parallel 20140711alpha has been released. It is available for > download at: http://alpha.gnu.org/gnu/parallel/parallel-20140711.tar.bz2 > > Thanks to Malcolm Cook this alpha release features a major change: Use > a general perl expression as a replacement string. I have a feeling > this will prove to be super cool. > > parallel echo '{= s:\.[^/.]+$::;s:\.[^/.]+$:: =}' ::: dir/file.ext1.ext2 > > You can also define your own replacement string using --rpl. This way > remove two file extensions can be done: > > parallel --rpl '{..} s:\.[^/.]+$::;s:\.[^/.]+$::' echo {..} ::: > dir/file.ext1.ext2 > > If you choose your replacement string to start with { it works > automatically for positional replacement: > > parallel -N3 --rpl '{..} s:\.[^/.]+$::;s:\.[^/.]+$::' echo {2..} ::: > foo dir/file.ext1.ext2 bar > > This alpha release has known bugs (e.g. {%} does not work with --pipe) > but should be usable for most situations. > > The changes to get the basic perl replacement string to work was > remarkably easy, but getting all the corner cases to work has be quite > a task. So the code changes have been quite extensive and have been in > the core of the code making it likely that some functionality is > broken. > > Let us see if you can find bugs, that are not found by my testsuite > yet. I am especially interested in things that make it crash or go > into an infinite loop. > > Excerpt from man page below. > > > /Ole > > {=perl expression=} > Replace with calculated perl expression. $_ will contain the same as > {}. After evaluating perl expression $_ will be used as the value. It > is recommended to only change $_ but you have full access to all of > GNU parallel's internal functions and data structures. > > See also: --rpl --parens > > --parens parensstring (alpha testing) > Use to define start and end parenthesis for {= perlexpr =}. The left > and the right parenthesis can be multiple characters and are assumed > to be the same length. The default is {==} giving {= as the start > parenthesis and =} as the end parenthesis. > > Another useful setting is ,,,, which would make both parenthesis ,,. > > See also: --rpl {= perlexpr =} > > --rpl 'tag perl expression' (alpha testing) > Use tag as a replacement string for perl expression. This makes it > possible to define your own replacement strings. GNU parallel's 7 > replacement strings are implemented as: > > --rpl '{} ' > --rpl '{#} $_=$job->seq()' > --rpl '{%} $_=$job->slot()' > --rpl '{/} s:.*/::' > --rpl '{//} $Global::use{"File::Basename"} ||= eval "use > File::Basename; 1;"; $_ = dirname($_);' > --rpl '{/.} s:.*/::; s:\.[^/.]+$::;' > --rpl '{.} s:\.[^/.]+$::' > > If the user defined replacement string starts with '{' it can also be > used as a positional replacement string (like {2.}). > > It is recommended to only change $_ but you have full access to all > of GNU parallel's internal functions and data structures. > > See also: {= perlexpr =} --parens