On Thu, Jun 26, 2014 at 10:13 AM, Ole Tange <o...@tange.dk> wrote:
> On Thu, Jun 26, 2014 at 2:20 AM, Ole Tange <o...@tange.dk> wrote:
>> On Wed, Jun 25, 2014 at 11:53 PM, Ole Tange <o...@tange.dk> wrote:
>>
>>> So instead it could be {{perl expression}}. I don't think the {{...}}
>>> is something you would otherwise write on the command line.

I was wrong. I analysed a few million lines of perl code: {{...}} is
not that uncommon. However, {= ... =} is extremely uncommon. So unless
there are heavy reason not to, then {= ... =} will be the magic
braces.

> Maybe with a syntax like:
>
>   # add 10
>   parallel --rpl {+} '{{ $_+=10 }}' -n2 echo {1+} {2+} ::: 10 20
>   # remove 2 extensions
>   parallel --rpl {..} '{{ s/(\.[^.]+){2}$// }}' echo {..} ::: 
> dir/file.ext1.ext2

I do not see a way for a --option to take 2 values. But it will be
reasonable to split on the first space. So it will have to be
something like:

    parallel --rpl '{+} {= $_+=10 =}' -n2 echo {1+} {2+} ::: 10 20
    parallel --rpl '{..} {= s/(\.[^.]+){2}$// =}' echo {..} :::
dir/file.ext1.ext2

/Ole

Reply via email to