parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replacement strings


From: Ole Tange
Subject: Re: Replacement strings
Date: Tue, 1 Jul 2014 20:55:35 +0200

On Thu, Jun 26, 2014 at 10:13 AM, Ole Tange <ole@tange.dk> wrote:
> On Thu, Jun 26, 2014 at 2:20 AM, Ole Tange <ole@tange.dk> wrote:
>> On Wed, Jun 25, 2014 at 11:53 PM, Ole Tange <ole@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

[Prev in Thread] Current Thread [Next in Thread]