Hi Datakanja,

I am not entirely sure what you are trying to do, but the arguments

this should not happen

are already separated per default POSIX parsing. You do not need --colsep.

Thus

parallel --dry-run -n 2 echo {} ::: this should not happen

correctly produces on my macbook, with 2 processors:

echo this should
echo not happen

as the maximum number of arguments assigned to echo will be 2, so the first two 
arguments are sent to processor 1 and the next two are sent to processor 2.

If you want each processor to echo one argument at a time, then do:

parallel --dry-run -n 1 echo {} ::: this should not happen

which then gives:

echo this
echo should
echo not
echo happen

This is what you want to do right?

I hope this will be helpful.

Best regards,

Lianheng


================================================
Lianheng Tong                                    Tel: +44 79 1758 3822  
Room S4.02, Strand Building           Fax: +44 20 7848 2420  
Department of Physics                       lianheng.t...@kcl.ac.uk
Kings College London                                  
Strand, London WC2R 2LS, U.K.                         
================================================

On 6 Jan 2014, at 11:06, ChessDoter wrote:

> Hi Lianheng,
> 
> thanks for avoiding calling me PEBE. ;-)
> 
> Ok, i do see now, that the ` has to be escaped, like
> 
> echo this should not happen | xargs -n 1 echo | parallel --dry-run -n 2 echo 
> \`echo {}\`
> 
> Would you please provide a pointer to the solution of the --colsep problem? i 
> wasnt able to get rid of the xargs step for that on my own.
> 
> Best regards
> Datakanja
> 
> Am 06.01.2014 11:42, schrieb Lianheng Tong:
>> Hi,
>> 
>> I think the problem you have encountered is a problem associated with a 
>> possible misunderstanding how POSIX command lines are interpreted by the 
>> system, rather than a particular problem with parallel.
>> 
>> Best regards,
>> 
>> Lianheng
>> 
>> ================================================
>> Lianheng Tong                      Tel: +44 79 1758 3822
>> Room S4.02, Strand Building           Fax: +44 20 7848 2420
>> Department of Physics lianheng.t...@kcl.ac.uk 
>> <mailto:lianheng.t...@kcl.ac.uk>
>> Kings College London
>> Strand, London WC2R 2LS, U.K.
>> ================================================
>> 
>> On 6 Jan 2014, at 10:35, ChessDoter wrote:
>> 
>>> hello,
>>> 
>>> far from being a power user with linux...
>>> 
>>> ... i happen to play with parallel...
>>> 
>>> and get confused/surprised at times. Like so:
>>> 
>>> echo this should not happen | xargs -n 1 echo | parallel --dry-run -n 2 
>>> echo `echo {}`
>>> 
>>> First, i was not able to separate the 4 words into different arguments with 
>>> --colsep ' ', so that is why i used xargs in the mix.
>>> Then, i did not expect --dry-run to allow for execution of the embedded 
>>> `echo` command.
>>> 
>>> Ok, i can imagine scenarios, when this comes in handily...
>>> 
>>> My current conclusion is: be VERY careful with this powerful tool, test 
>>> thoroughly before execution but even then... (can i trust it?) beware of 
>>> unexpected side-effects.
>>> 
>>> just my 2 cents

Reply via email to